You are here

public function CommentManager::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/comment/src/CommentManager.php \Drupal\comment\CommentManager::__construct()

Construct the CommentManager object.

Parameters

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

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

\Drupal\Core\StringTranslation\TranslationInterface $string_translation: The string translation service.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler service.

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

\Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager: The entity field manager service.

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

File

core/modules/comment/src/CommentManager.php, line 102

Class

CommentManager
Comment manager contains common functions to manage comment fields.

Namespace

Drupal\comment

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, TranslationInterface $string_translation, ModuleHandlerInterface $module_handler, AccountInterface $current_user, EntityFieldManagerInterface $entity_field_manager = NULL, EntityDisplayRepositoryInterface $entity_display_repository = NULL) {
  $this->entityTypeManager = $entity_type_manager;
  $this->userConfig = $config_factory
    ->get('user.settings');
  $this->stringTranslation = $string_translation;
  $this->moduleHandler = $module_handler;
  $this->currentUser = $current_user;
  if (!$entity_field_manager) {
    @trigger_error('The entity_field.manager service must be passed to CommentManager::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $entity_field_manager = \Drupal::service('entity_field.manager');
  }
  $this->entityFieldManager = $entity_field_manager;
  if (!$entity_display_repository) {
    @trigger_error('The entity_display.repository service must be passed to CommentManager::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2835616.', E_USER_DEPRECATED);
    $entity_display_repository = \Drupal::service('entity_display.repository');
  }
  $this->entityDisplayRepository = $entity_display_repository;
}