You are here

protected function EntityRevisionRouteEnhancer::applies in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Routing/Enhancer/EntityRevisionRouteEnhancer.php \Drupal\Core\Routing\Enhancer\EntityRevisionRouteEnhancer::applies()

Returns whether the enhancer runs on the current route.

Parameters

\Symfony\Component\Routing\Route $route: The current route.

Return value

bool

1 call to EntityRevisionRouteEnhancer::applies()
EntityRevisionRouteEnhancer::enhance in core/lib/Drupal/Core/Routing/Enhancer/EntityRevisionRouteEnhancer.php
Update the defaults based on its own data and the request.

File

core/lib/Drupal/Core/Routing/Enhancer/EntityRevisionRouteEnhancer.php, line 23

Class

EntityRevisionRouteEnhancer
Adds _entity_revision to the request attributes, if possible.

Namespace

Drupal\Core\Routing\Enhancer

Code

protected function applies(Route $route) {

  // Check whether there is any entity revision parameter.
  $parameters = $route
    ->getOption('parameters') ?: [];
  foreach ($parameters as $info) {
    if (isset($info['type']) && strpos($info['type'], 'entity_revision:') === 0) {
      return TRUE;
    }
  }
  return FALSE;
}