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

Breadcrumb

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

function 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 783

Class

Url
Defines an object that holds information about a URL.

Namespace

Drupal\Core

Code

public function getInternalPath() {
    if ($this->unrouted) {
        throw new \UnexpectedValueException('Unrouted URIs do not have internal representations.');
    }
    if (!isset($this->internalPath)) {
        $this->internalPath = $this->urlGenerator()
            ->getPathFromRoute($this->getRouteName(), $this->getRouteParameters());
    }
    return $this->internalPath;
}
RSS feed
Powered by Drupal