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

Breadcrumb

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

function Url::__construct

Same name in this branch
  1. 11.1.x vendor/phar-io/manifest/src/values/Url.php \PharIo\Manifest\Url::__construct()
  2. 11.1.x vendor/symfony/validator/Constraints/Url.php \Symfony\Component\Validator\Constraints\Url::__construct()
  3. 11.1.x vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url::__construct()

Constructs a new Url object.

In most cases, use Url::fromRoute() or Url::fromUri() rather than constructing Url objects directly in order to avoid ambiguity and make your code more self-documenting.

@todo Update this documentation for non-routed URIs in https://www.drupal.org/node/2346787

Parameters

string $route_name: The name of the route

array $route_parameters: (optional) An associative array of parameter names and values.

array $options: See \Drupal\Core\Url::fromUri() for details.

See also

static::fromRoute()

static::fromUri()

File

core/lib/Drupal/Core/Url.php, line 127

Class

Url
Defines an object that holds information about a URL.

Namespace

Drupal\Core

Code

public function __construct($route_name, $route_parameters = [], $options = []) {
    $this->routeName = $route_name;
    $this->routeParameters = $route_parameters;
    $this->options = $options;
}
RSS feed
Powered by Drupal