public function BookBreadcrumbBuilder::__construct in Drupal 9
Same name and namespace in other branches
- 8 core/modules/book/src/BookBreadcrumbBuilder.php \Drupal\book\BookBreadcrumbBuilder::__construct()
Constructs the BookBreadcrumbBuilder.
Parameters
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager service.
\Drupal\Core\Session\AccountInterface $account: The current user account.
\Drupal\Core\Entity\EntityRepositoryInterface|null $entity_repository: The entity repository service.
\Drupal\Core\Language\LanguageManagerInterface|null $language_manager: The language manager service.
File
- core/
modules/ book/ src/ BookBreadcrumbBuilder.php, line 63
Class
- BookBreadcrumbBuilder
- Provides a breadcrumb builder for nodes in a book.
Namespace
Drupal\bookCode
public function __construct(EntityTypeManagerInterface $entity_type_manager, AccountInterface $account, EntityRepositoryInterface $entity_repository = NULL, LanguageManagerInterface $language_manager = NULL) {
$this->nodeStorage = $entity_type_manager
->getStorage('node');
$this->account = $account;
if (!$entity_repository) {
@trigger_error('The entity.repository service must be passed to ' . __NAMESPACE__ . '\\BookBreadcrumbBuilder::__construct(). It was added in drupal:9.2.0 and will be required before drupal:10.0.0.', E_USER_DEPRECATED);
$entity_repository = \Drupal::service('entity.repository');
}
if (!$language_manager) {
@trigger_error('The language_manager service must be passed to ' . __NAMESPACE__ . '\\BookBreadcrumbBuilder::__construct(). It was added in drupal:9.2.0 and will be required before drupal:10.0.0.', E_USER_DEPRECATED);
$language_manager = \Drupal::service('language_manager');
}
$this->entityRepository = $entity_repository;
$this->languageManager = $language_manager;
}