You are here

protected function PanelsBreadcrumbBuilder::addCaching in Panels Breadcrumbs 8

Add cacheable dependencies and cache contexts.

1 call to PanelsBreadcrumbBuilder::addCaching()
PanelsBreadcrumbBuilder::build in src/Breadcrumb/PanelsBreadcrumbBuilder.php
Builds the breadcrumb.

File

src/Breadcrumb/PanelsBreadcrumbBuilder.php, line 158

Class

PanelsBreadcrumbBuilder
Class PanelsBreadcrumbBuilder.

Namespace

Drupal\panels_breadcrumbs\Breadcrumb

Code

protected function addCaching(RouteMatchInterface $route_match, Breadcrumb $breadcrumb) {
  $parameters = $route_match
    ->getParameters();
  foreach ($parameters as $key => $parameter) {
    if ($parameter instanceof CacheableDependencyInterface) {
      $breadcrumb
        ->addCacheableDependency($parameter);
    }
  }
  $breadcrumb
    ->addCacheContexts([
    'url.path',
  ]);
}