You are here

public static function UrlHelper::encodePath in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Utility/UrlHelper.php \Drupal\Component\Utility\UrlHelper::encodePath()

Encodes a Drupal path for use in a URL.

For aesthetic reasons slashes are not escaped.

Parameters

string $path: The Drupal path to encode.

Return value

string The encoded path.

7 calls to UrlHelper::encodePath()
BigPipeTest::testNoJsDetection in core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
Tests BigPipe's no-JS detection.
ContextualLinks::render in core/modules/contextual/src/Plugin/views/field/ContextualLinks.php
Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
FieldWebTest::testAlterUrl in core/modules/views/tests/src/Functional/Handler/FieldWebTest.php
Tests rewriting the output to a link.
FileUrlGenerator::generate in core/lib/Drupal/Core/File/FileUrlGenerator.php
Creates a root-relative web-accessible URL object.
FileUrlGenerator::generatePath in core/lib/Drupal/Core/File/FileUrlGenerator.php
Generate a URL path.

... See full list

File

core/lib/Drupal/Component/Utility/UrlHelper.php, line 195

Class

UrlHelper
Helper class URL based methods.

Namespace

Drupal\Component\Utility

Code

public static function encodePath($path) {
  return str_replace('%2F', '/', rawurlencode($path));
}