function CommentDefaultFormatter::__construct

Same name and namespace in other branches
  1. 11.x core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::__construct()
  2. 10 core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::__construct()
  3. 9 core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::__construct()
  4. 8.9.x core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::__construct()

Constructs a new CommentDefaultFormatter.

Parameters

string $plugin_id: The plugin ID for the formatter.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The definition of the field to which the formatter is associated.

array $settings: The formatter settings.

string $label: The formatter label display setting.

string $view_mode: The view mode.

array $third_party_settings: Third party settings.

\Drupal\Core\Session\AccountInterface $currentUser: The current user.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\Core\Entity\EntityFormBuilderInterface $entityFormBuilder: The entity form builder.

\Drupal\Core\Routing\RouteMatchInterface $routeMatch: The route match object.

\Drupal\Core\Entity\EntityDisplayRepositoryInterface $entityDisplayRepository: The entity display repository.

Overrides FormatterBase::__construct

File

core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php, line 84

Class

CommentDefaultFormatter
Provides a default comment formatter.

Namespace

Drupal\comment\Plugin\Field\FieldFormatter

Code

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, protected AccountInterface $currentUser, EntityTypeManagerInterface $entity_type_manager, protected EntityFormBuilderInterface $entityFormBuilder, protected RouteMatchInterface $routeMatch, protected EntityDisplayRepositoryInterface $entityDisplayRepository) {
  parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
  $this->viewBuilder = $entity_type_manager->getViewBuilder('comment');
  $this->storage = $entity_type_manager->getStorage('comment');
}

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