You are here

public static function UrlHelper::encodePath in Zircon Profile 8.0

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.

5 calls to UrlHelper::encodePath()
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/src/Tests/Handler/FieldWebTest.php
Tests rewriting the output to a link.
file_create_url in core/includes/file.inc
Creates a web-accessible URL for a stream to an external or local file.
PublicStream::getExternalUrl in core/lib/Drupal/Core/StreamWrapper/PublicStream.php
Returns a web accessible URL for the resource.
UrlHelperTest::testEncodePath in core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php
Tests path encoding.

File

core/lib/Drupal/Component/Utility/UrlHelper.php, line 198
Contains \Drupal\Component\Utility\UrlHelper.

Class

UrlHelper
Helper class URL based methods.

Namespace

Drupal\Component\Utility

Code

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