You are here

public function PhotosBreadcrumbBuilder::applies in Album Photos 8.4

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/PhotosBreadcrumbBuilder.php, line 60

Class

PhotosBreadcrumbBuilder
Photos breadcrumb builder.

Namespace

Drupal\photos

Code

public function applies(RouteMatchInterface $route_match) {

  // Check if image page.
  $fid = $route_match
    ->getParameter('file');
  if ($fid) {
    $path = trim($this->context
      ->getPathInfo(), '/');
    $path_elements = explode('/', $path);
    return $path_elements[0] == 'photos' && $path_elements[1] == 'image';
  }
}