Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityRevisionRouteEnhancer.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal