getCommentFields example


  public function query() {
    return $this->select('node_type', 't')
      ->fields('t', ['type', 'name']);
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $node_type = $row->getSourceProperty('type');
    foreach (array_keys($this->getCommentFields()) as $field) {
      $row->setSourceProperty($field$this->variableGet($field . '_' . $node_type, NULL));
    }

    return parent::prepareRow($row);
  }

  /** * {@inheritdoc} */
  public function fields() {
    return [
      
'title_label' => $this->t('Title label.'),
      'has_body' => $this->t('Flag indicating the node type has a body field.'),
      'body_label' => $this->t('Body label.'),
      'min_word_count' => $this->t('Minimum word count for the body field.'),
      'custom' => $this->t('Flag.'),
      'modified' => $this->t('Flag.'),
      'locked' => $this->t('Flag.'),
      'orig_type' => $this->t('The original type.'),
      'teaser_length' => $this->t('Teaser length'),
    ];
    if ($this->moduleExists('comment')) {
      $fields += $this->getCommentFields();
    }
    return $fields;
  }

  /** * Returns the fields containing comment settings for each node type. * * @return string[] * An associative array of field descriptions, keyed by field. */
  protected function getCommentFields() {
    
'help' => $this->t('Help text for the node type.'),
      'title_label' => $this->t('Title label.'),
      'disabled' => $this->t('Flag indicating the node type is enable'),
      'base' => $this->t('base node.'),
      'custom' => $this->t('Flag.'),
      'modified' => $this->t('Flag.'),
      'locked' => $this->t('Flag.'),
      'orig_type' => $this->t('The original type.'),
      'teaser_length' => $this->t('Teaser length'),
    ];
    if ($this->moduleExists('comment')) {
      $fields += $this->getCommentFields();
    }
    return $fields;
  }

  /** * Returns the fields containing comment settings for each node type. * * @return string[] * An associative array of field descriptions, keyed by field. */
  protected function getCommentFields() {
    
Home | Imprint | This part of the site doesn't use cookies.