function CommentLinkBuilder::__construct
Constructs a new CommentLinkBuilder object.
Parameters
\Drupal\Core\Session\AccountInterface $current_user: Current user.
\Drupal\comment\CommentManagerInterface $comment_manager: Comment manager service.
\Drupal\Core\StringTranslation\TranslationInterface|\Drupal\Core\Extension\ModuleHandlerInterface $string_translation: String translation service.
File
-
core/
modules/ comment/ src/ CommentLinkBuilder.php, line 60
Class
- CommentLinkBuilder
- Defines a class for building markup for comment links on a commented entity.
Namespace
Drupal\commentCode
public function __construct(AccountInterface $current_user, CommentManagerInterface $comment_manager, #[Autowire(service: TranslationInterface::class)] TranslationInterface|ModuleHandlerInterface $string_translation) {
if ($string_translation instanceof ModuleHandlerInterface) {
@trigger_error('Passing the $module_handler argument to ' . __METHOD__ . '() is deprecated in drupal:11.3.0 and will be removed in drupal:12.0.0. See https://www.drupal.org/node/3544527', E_USER_DEPRECATED);
$string_translation = \Drupal::service(TranslationInterface::class);
}
if (array_any(func_get_args(), fn($arg) => $arg instanceof EntityTypeManagerInterface)) {
@trigger_error('Passing the $entity_type_manager argument to ' . __METHOD__ . '() is deprecated in drupal:11.3.0 and will be removed in drupal:12.0.0. See https://www.drupal.org/node/3544527', E_USER_DEPRECATED);
}
$this->currentUser = $current_user;
$this->commentManager = $comment_manager;
$this->stringTranslation = $string_translation;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.