public function HierarchyBasedBreadcrumbBuilder::applies in Entity Reference Hierarchy 3.x
Same name and namespace in other branches
- 8.2 modules/entity_hierarchy_breadcrumb/src/HierarchyBasedBreadcrumbBuilder.php \Drupal\entity_hierarchy_breadcrumb\HierarchyBasedBreadcrumbBuilder::applies()
Whether this breadcrumb builder should be used to build the breadcrumb.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.
Return value
bool TRUE if this builder should be used or FALSE to let other builders decide.
Overrides BreadcrumbBuilderInterface::applies
File
- modules/
entity_hierarchy_breadcrumb/ src/ HierarchyBasedBreadcrumbBuilder.php, line 89
Class
- HierarchyBasedBreadcrumbBuilder
- Entity hierarchy based breadcrumb builder.
Namespace
Drupal\entity_hierarchy_breadcrumbCode
public function applies(RouteMatchInterface $route_match) {
if ($this->adminContext
->isAdminRoute($route_match
->getRouteObject())) {
return FALSE;
}
$route_entity = $this
->getEntityFromRouteMatch($route_match);
if (!$route_entity || !$route_entity instanceof ContentEntityInterface || !$this
->getHierarchyFieldFromEntity($route_entity)) {
return FALSE;
}
return TRUE;
}