function CommentHooks::entityExtraFieldInfo

Implements hook_entity_extra_field_info().

Attributes

#[Hook('entity_extra_field_info')]

File

core/modules/comment/src/Hook/CommentHooks.php, line 76

Class

CommentHooks
Hook implementations for comment.

Namespace

Drupal\comment\Hook

Code

public function entityExtraFieldInfo() : array {
  $return = [];
  foreach (CommentType::loadMultiple() as $comment_type) {
    $return['comment'][$comment_type->id()] = [
      'form' => [
        'author' => [
          'label' => $this->t('Author'),
          'description' => $this->t('Author textfield'),
          'weight' => -2,
        ],
      ],
    ];
    $return['comment'][$comment_type->id()]['display']['links'] = [
      'label' => $this->t('Links'),
      'description' => $this->t('Comment operation links'),
      'weight' => 100,
      'visible' => TRUE,
    ];
  }
  return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.