// Remove the base: scheme.
// @todo Consider using a class constant for this in
// https://www.drupal.org/node/2417459
$uri =
substr($uri, 5
);
// Allow (outbound) path processing, if needed. A valid use case is the path
// alias overview form:
// @see \Drupal\path\Controller\PathController::adminOverview().
if (!
empty($options['path_processing'
])) { // Do not pass the request, since this is a special case and we do not
// want to include e.g. the request language in the processing.
$uri =
$this->pathProcessor->
processOutbound($uri,
$options, NULL,
$generated_url);
} // Strip leading slashes from internal paths to prevent them becoming
// external URLs without protocol. /example.com should not be turned into
// //example.com.
$uri =
ltrim($uri, '/'
);
// Add any subdirectory where Drupal is installed.
$current_base_path =
$request->
getBasePath() . '/';
if ($options['absolute'
]) { $current_base_url =
$request->
getSchemeAndHttpHost() .
$current_base_path;