function CommentDefaultFormatter::__construct

Same name in other branches
  1. 9 core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::__construct()
  2. 8.9.x core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::__construct()
  3. 11.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 $current_user: The current user.

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

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

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

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

Overrides FormatterBase::__construct

File

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

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, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager, EntityFormBuilderInterface $entity_form_builder, RouteMatchInterface $route_match, EntityDisplayRepositoryInterface $entity_display_repository) {
    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');
    $this->currentUser = $current_user;
    $this->entityFormBuilder = $entity_form_builder;
    $this->routeMatch = $route_match;
    $this->entityDisplayRepository = $entity_display_repository;
}

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