You are here

public function EntityRevisionRouteEnhancer::applies in Entity API 8.0

Declares if the route enhancer applies to the given route.

Parameters

\Symfony\Component\Routing\Route $route: The route to consider attaching to.

Return value

bool TRUE if the check applies to the passed route, False otherwise.

Overrides RouteEnhancerInterface::applies

File

src/RouteEnhancer/EntityRevisionRouteEnhancer.php, line 23
Contains \Drupal\entity\RouteEnhancer\EntityRevisionRouteEnhancer.

Class

EntityRevisionRouteEnhancer
Adds _entity_revision to the request attributes, if possible.

Namespace

Drupal\entity\RouteEnhancer

Code

public 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;
}