public function TermBreadcrumbBuilder::__construct in Drupal 8
Same name and namespace in other branches
- 9 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;
}