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

Breadcrumb

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

function Route::__construct

Same name in this branch
  1. 11.1.x vendor/symfony/routing/Route.php \Symfony\Component\Routing\Route::__construct()
  2. 11.1.x core/modules/migrate/src/Plugin/migrate/process/Route.php \Drupal\migrate\Plugin\migrate\process\Route::__construct()

Parameters

string|array<string,string>|null $path The route path (i.e. "/user/login"):

string|null $name The route name (i.e. "app_user_login"):

array<string|\Stringable> $requirements Requirements for the route attributes, @see https://symfony.com/doc/current/routing.html#parameters-validation:

array<string, mixed> $options Options for the route (i.e. ['prefix' => '/api']):

array<string, mixed> $defaults Default values for the route attributes and query parameters:

string|null $host The host for which this route should be active (i.e. "localhost"):

string|string[] $methods The list of HTTP methods allowed by this route:

string|string[] $schemes The list of schemes allowed by this route (i.e. "https"):

string|null $condition An expression that must evaluate to true for the route to be matched, @see https://symfony.com/doc/current/routing.html#matching-expressions:

int|null $priority The priority of the route if multiple ones are defined for the same path:

string|null $locale The locale accepted by the route:

string|null $format The format returned by the route (i.e. "json", "xml"):

bool|null $utf8 Whether the route accepts UTF-8 in its parameters:

bool|null $stateless Whether the route is defined as stateless or stateful, @see https://symfony.com/doc/current/routing.html#stateless-routes:

string|null $env The env in which the route is defined (i.e. "dev", "test", "prod"):

File

vendor/symfony/routing/Attribute/Route.php, line 43

Class

Route
@author Fabien Potencier <fabien@symfony.com> @author Alexander M. Turek <me@derrabus.de>

Namespace

Symfony\Component\Routing\Attribute

Code

public function __construct(string|array|null $path = null, ?string $name = null, array $requirements = [], array $options = [], array $defaults = [], ?string $host = null, array|string $methods = [], array|string $schemes = [], ?string $condition = null, ?int $priority = null, ?string $locale = null, ?string $format = null, ?bool $utf8 = null, ?bool $stateless = null, ?string $env = null) {
    if (\is_array($path)) {
        $this->localizedPaths = $path;
    }
    else {
        $this->path = $path;
    }
    $this->setMethods($methods);
    $this->setSchemes($schemes);
    if (null !== $locale) {
        $this->defaults['_locale'] = $locale;
    }
    if (null !== $format) {
        $this->defaults['_format'] = $format;
    }
    if (null !== $utf8) {
        $this->options['utf8'] = $utf8;
    }
    if (null !== $stateless) {
        $this->defaults['_stateless'] = $stateless;
    }
}

API Navigation

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