Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Url.php

function Url::fromRouteMatch

Creates a new URL object from a route match.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.

Return value

static

3 calls to Url::fromRouteMatch()
LanguageBlock::build in core/modules/language/src/Plugin/Block/LanguageBlock.php
Builds and returns the renderable array for this block plugin.
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.

File

core/lib/Drupal/Core/Url.php, line 165

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');
    }
}
RSS feed
Powered by Drupal