function Url::fromRouteMatch
Same name in other branches
- 9 core/lib/Drupal/Core/Url.php \Drupal\Core\Url::fromRouteMatch()
- 8.9.x core/lib/Drupal/Core/Url.php \Drupal\Core\Url::fromRouteMatch()
- 10 core/lib/Drupal/Core/Url.php \Drupal\Core\Url::fromRouteMatch()
Creates a new URL object from a route match.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.
Return value
static
4 calls to Url::fromRouteMatch()
- LanguageBlock::build in core/
modules/ language/ src/ Plugin/ Block/ LanguageBlock.php - PathBasedBreadcrumbBuilder::build in core/
modules/ system/ src/ PathBasedBreadcrumbBuilder.php - Builds the breadcrumb.
- PathMatcher::isFrontPage in core/
lib/ Drupal/ Core/ Path/ PathMatcher.php - Checks if the current page is the front page.
- UrlTest::testFromRouteMatch in core/
tests/ Drupal/ Tests/ Core/ UrlTest.php - Tests the fromRouteMatch() method.
File
-
core/
lib/ Drupal/ Core/ Url.php, line 165
Class
- Url
- Defines an object that holds information about a URL.
Namespace
Drupal\CoreCode
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');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.