Url::getRouteName

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

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::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::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::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::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::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::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::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::accessManager

protected Url::accessManager() Return value \Drupal\Core\Access\AccessManagerInterface File core/lib/Drupal/Core/Url.php, line 812 Class Url Defines an object that holds information about a URL. Namespace Drupal\Core Code protected function accessManager() { if (!isset($this->accessManager)) { $this->accessManager = \Drupal::service('access_manager'); } return $this->accessManager; }