function Url::__construct
Same name in other branches
- 9 core/lib/Drupal/Core/Url.php \Drupal\Core\Url::__construct()
- 8.9.x core/lib/Drupal/Core/Url.php \Drupal\Core\Url::__construct()
- 11.x 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
File
-
core/
lib/ Drupal/ Core/ Url.php, line 127
Class
- Url
- Defines an object that holds information about a URL.
Namespace
Drupal\CoreCode
public function __construct($route_name, $route_parameters = [], $options = []) {
$this->routeName = $route_name;
$this->routeParameters = $route_parameters;
$this->options = $options;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.