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($route_match->getRouteName(), $route_match->getRawParameters()->all());
  }
  else {
    throw new \InvalidArgumentException('Route required');
  }
}
 
          
Please login to continue.