You are here

protected function EntityRevisionRouteEnhancer::applies in Drupal 9

Same name and namespace in other branches
  1. 8 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
Updates the defaults for a route definition based on 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;
}