function TermBreadcrumbBuilder::__construct
Same name in other branches
- 9 core/modules/taxonomy/src/TermBreadcrumbBuilder.php \Drupal\taxonomy\TermBreadcrumbBuilder::__construct()
- 10 core/modules/taxonomy/src/TermBreadcrumbBuilder.php \Drupal\taxonomy\TermBreadcrumbBuilder::__construct()
- 11.x core/modules/taxonomy/src/TermBreadcrumbBuilder.php \Drupal\taxonomy\TermBreadcrumbBuilder::__construct()
Constructs the TermBreadcrumbBuilder.
Parameters
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.
\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository.
File
-
core/
modules/ taxonomy/ src/ TermBreadcrumbBuilder.php, line 55
Class
- TermBreadcrumbBuilder
- Provides a custom taxonomy breadcrumb builder that uses the term hierarchy.
Namespace
Drupal\taxonomyCode
public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityRepositoryInterface $entity_repository = NULL) {
$this->entityTypeManager = $entity_type_manager;
$this->termStorage = $entity_type_manager->getStorage('taxonomy_term');
if (!$entity_repository) {
@trigger_error('The entity.repository service must be passed to TermBreadcrumbBuilder::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
$entity_repository = \Drupal::service('entity.repository');
}
$this->entityRepository = $entity_repository;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.