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

Breadcrumb

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

function UrlMatcher::getAttributes

Same name in this branch
  1. 11.1.x core/lib/Drupal/Core/Routing/UrlMatcher.php \Drupal\Core\Routing\UrlMatcher::getAttributes()

Returns an array of values to use as request attributes.

As this method requires the Route object, it is not available in matchers that do not have access to the matched Route instance (like the PHP and Apache matcher dumpers).

2 calls to UrlMatcher::getAttributes()
TraceableUrlMatcher::matchCollection in vendor/symfony/routing/Matcher/TraceableUrlMatcher.php
Tries to match a URL with a set of routes.
UrlMatcher::matchCollection in vendor/symfony/routing/Matcher/UrlMatcher.php
Tries to match a URL with a set of routes.
1 method overrides UrlMatcher::getAttributes()
UrlMatcher::getAttributes in core/lib/Drupal/Core/Routing/UrlMatcher.php
Returns an array of values to use as request attributes.

File

vendor/symfony/routing/Matcher/UrlMatcher.php, line 191

Class

UrlMatcher
UrlMatcher matches URL based on a set of routes.

Namespace

Symfony\Component\Routing\Matcher

Code

protected function getAttributes(Route $route, string $name, array $attributes) : array {
    $defaults = $route->getDefaults();
    if (isset($defaults['_canonical_route'])) {
        $name = $defaults['_canonical_route'];
        unset($defaults['_canonical_route']);
    }
    $attributes['_route'] = $name;
    if ($mapping = $route->getOption('mapping')) {
        $attributes['_route_mapping'] = $mapping;
    }
    return $this->mergeDefaults($attributes, $defaults);
}
RSS feed
Powered by Drupal