function EntityRevisionRouteEnhancer::applies

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/Enhancer/EntityRevisionRouteEnhancer.php \Drupal\Core\Routing\Enhancer\EntityRevisionRouteEnhancer::applies()
  2. 8.9.x core/lib/Drupal/Core/Routing/Enhancer/EntityRevisionRouteEnhancer.php \Drupal\Core\Routing\Enhancer\EntityRevisionRouteEnhancer::applies()
  3. 10 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

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']) && str_starts_with($info['type'], 'entity_revision:')) {
            return TRUE;
        }
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.