Url::getRouteParameters

public Url::getRouteParameters() Returns the route parameters. Return value array Throws \UnexpectedValueException. If this is a URI with no corresponding route. File core/lib/Drupal/Core/Url.php, line 568 Class Url Defines an object that holds information about a URL. Namespace Drupal\Core Code public function getRouteParameters() { if ($this->unrouted) { throw new \UnexpectedValueException('External URLs do not have internal route parameters.'); } return $this->rou

Url::getInfo

public Url::getInfo() Returns the element properties for this element. Return value array An array of element properties. See \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for documentation of the standard properties of all elements, and the return value format. Overrides ElementInterface::getInfo File core/lib/Drupal/Core/Render/Element/Url.php, line 34 Class Url Provides a form element for input of a URL. Namespace Drupal\Core\Render\Element Code public function getInfo

Url::fromUri

public static Url::fromUri($uri, $options = []) Creates a new Url object from a URI. This method is for generating URLs for URIs that: do not have Drupal routes: both external URLs and unrouted local URIs like base:robots.txt do have a Drupal route but have a custom scheme to simplify linking. Currently, there is only the entity: scheme (This allows URIs of the form entity:{entity_type}/{entity_id}. For example: entity:node/1 resolves to the entity.node.canonical route with a node parameter of

Url::getInternalPath

public Url::getInternalPath() Returns the internal path (system path) for this route. This path will not include any prefixes, fragments, or query strings. Return value string The internal path for this route. Throws \UnexpectedValueException. If this is a URI with no corresponding system path. File core/lib/Drupal/Core/Url.php, line 766 Class Url Defines an object that holds information about a URL. Namespace Drupal\Core Code public function getInternalPath() { if ($this->unrou

Url::fromUserInput

public static Url::fromUserInput($user_input, $options = []) Creates a Url object for a relative URI reference submitted by user input. Use this method to create a URL for user-entered paths that may or may not correspond to a valid Drupal route. Parameters string $user_input: User input for a link or path. The first character must be one of the following characters: '/': A path within the current site. This path might be to a Drupal route (e.g., '/admin'), to a file (e.g., '/README.txt'), or

Url::fromInternalUri

protected static Url::fromInternalUri(array $uri_parts, array $options) Creates a new Url object for 'internal:' URIs. Important note: the URI minus the scheme can NOT simply be validated by a \Drupal\Core\Path\PathValidatorInterface implementation. The semantics of the 'internal:' URI scheme are different: PathValidatorInterface accepts paths without a leading slash (e.g. 'node/add') as well as 2 special paths: '<front>' and '<none>', which are mapped to the correspondingly named r

Url::fromRouteMatch

public static Url::fromRouteMatch(RouteMatchInterface $route_match) Creates a new URL object from a route match. Parameters \Drupal\Core\Routing\RouteMatchInterface $route_match: The route match. Return value $this File core/lib/Drupal/Core/Url.php, line 152 Class Url Defines an object that holds information about a URL. Namespace Drupal\Core Code public static function fromRouteMatch(RouteMatchInterface $route_match) { if ($route_match->getRouteObject()) { return new static

Url::fromRoute

public static Url::fromRoute($route_name, $route_parameters = array(), $options = array()) Creates a new Url object for a URL that has a Drupal route. This method is for URLs that have Drupal routes (that is, most pages generated by Drupal). For non-routed local URIs relative to the base path (like robots.txt) use Url::fromUri() with the base: scheme. Parameters string $route_name: The name of the route array $route_parameters: (optional) An associative array of route parameter names and value

Url::fromRouteUri

protected static Url::fromRouteUri(array $uri_parts, array $options, $uri) Creates a new Url object for 'route:' URIs. Parameters array $uri_parts: Parts from an URI of the form route:{route_name};{route_parameters} as from parse_url(), where the path is the route name optionally followed by a ";" followed by route parameters in key=value format with & separators. array $options: An array of options, see \Drupal\Core\Url::fromUri() for details. string $uri: The original passed in URI. Retu

Url::createFromRequest

public static Url::createFromRequest(Request $request) Returns the Url object matching a request. SECURITY NOTE: The request path is not checked to be valid and accessible by the current user to allow storing and reusing Url objects by different users. The 'path.validator' service getUrlIfValid() method should be used instead of this one if validation and access check is desired. Otherwise, 'access_manager' service checkNamedRoute() method should be used on the router name and parameters stored