function SkippablePathBasedBreadcrumbBuilder::applies
Overrides BreadcrumbBuilderInterface::applies
File
-
core/
modules/ system/ tests/ modules/ menu_test/ src/ SkippablePathBasedBreadcrumbBuilder.php, line 26
Class
- SkippablePathBasedBreadcrumbBuilder
- A path-based breadcrumb builder can be skipped from applying.
Namespace
Drupal\menu_testCode
public function applies(RouteMatchInterface $route_match, ?CacheableMetadata $cacheable_metadata = NULL) : bool {
$query_arg = 'menu_test_skip_breadcrumbs';
$cacheable_metadata?->addCacheContexts([
'url.query_args:' . $query_arg,
]);
// Apply unless the query argument is present.
return !$this->requestStack
->getCurrentRequest()->query
->has($query_arg);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.