function CommentForm::__construct

Same name in other branches
  1. 9 core/modules/comment/src/CommentForm.php \Drupal\comment\CommentForm::__construct()
  2. 8.9.x core/modules/comment/src/CommentForm.php \Drupal\comment\CommentForm::__construct()
  3. 10 core/modules/comment/src/CommentForm.php \Drupal\comment\CommentForm::__construct()

Constructs a new CommentForm.

Parameters

\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository.

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

\Drupal\Core\Render\RendererInterface $renderer: The renderer.

\Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info: The entity type bundle service.

\Drupal\Component\Datetime\TimeInterface $time: The time service.

\Drupal\Core\Entity\EntityFieldManagerInterface|null $entity_field_manager: (optional) The entity field manager service.

Overrides ContentEntityForm::__construct

File

core/modules/comment/src/CommentForm.php, line 81

Class

CommentForm
Base handler for comment forms.

Namespace

Drupal\comment

Code

public function __construct(EntityRepositoryInterface $entity_repository, AccountInterface $current_user, RendererInterface $renderer, EntityTypeBundleInfoInterface $entity_type_bundle_info, TimeInterface $time, ?EntityFieldManagerInterface $entity_field_manager = NULL) {
    parent::__construct($entity_repository, $entity_type_bundle_info, $time);
    $this->currentUser = $current_user;
    $this->renderer = $renderer;
    $this->entityFieldManager = $entity_field_manager ?: \Drupal::service('entity_field.manager');
}

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