function ContentTranslationHandler::__construct
Same name in other branches
- 9 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::__construct()
- 10 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::__construct()
- 11.x core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::__construct()
Initializes an instance of the content translation controller.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The info array of the given entity type.
\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager.
\Drupal\content_translation\ContentTranslationManagerInterface $manager: The content translation manager service.
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.
\Drupal\Core\Session\AccountInterface $current_user: The current user.
\Drupal\Core\Messenger\MessengerInterface $messenger: The messenger service.
\Drupal\Core\Datetime\DateFormatterInterface $date_formatter: The date formatter service.
File
-
core/
modules/ content_translation/ src/ ContentTranslationHandler.php, line 120
Class
- ContentTranslationHandler
- Base class for content translation handlers.
Namespace
Drupal\content_translationCode
public function __construct(EntityTypeInterface $entity_type, LanguageManagerInterface $language_manager, ContentTranslationManagerInterface $manager, EntityTypeManagerInterface $entity_type_manager, AccountInterface $current_user, MessengerInterface $messenger, DateFormatterInterface $date_formatter, EntityLastInstalledSchemaRepositoryInterface $entity_last_installed_schema_repository = NULL) {
$this->entityTypeId = $entity_type->id();
$this->entityType = $entity_type;
$this->languageManager = $language_manager;
$this->manager = $manager;
$this->entityTypeManager = $entity_type_manager;
$this->currentUser = $current_user;
if (!$entity_last_installed_schema_repository) {
@trigger_error('Calling ContentTranslationHandler::__construct() with the $entity_last_installed_schema_repository argument is supported in drupal:8.7.0 and will be required before drupal:9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
$entity_last_installed_schema_repository = \Drupal::service('entity.last_installed_schema.repository');
}
$this->fieldStorageDefinitions = $entity_last_installed_schema_repository->getLastInstalledFieldStorageDefinitions($this->entityTypeId);
$this->messenger = $messenger;
$this->dateFormatter = $date_formatter;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.