public function HierarchyBreadcrumbBuilder::applies in Entity Reference Hierarchy 8
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
- src/
HierarchyBreadcrumbBuilder.php, line 29 - Contains \Drupal\entity_hierarchy\HierarchyBreadcrumbBuilder.
Class
- HierarchyBreadcrumbBuilder
- Provides a breadcrumb builder for nodes in a book.
Namespace
Drupal\entity_hierarchyCode
public function applies(RouteMatchInterface $route_match) {
$node = $route_match
->getParameter('node');
$parent = null;
if ($node instanceof NodeInterface) {
$current_nid = $node
->id();
$hierarchy_storage = \Drupal::service('entity_hierarchy.outline_storage');
$parent = $hierarchy_storage
->hierarchyGetParent($current_nid);
}
return !empty($parent) ? true : false;
}