You are here

public function Url::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Url.php \Drupal\Core\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 124

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