You are here

public static function UrlHelper::encodePath in Service Container 7.2

Same name and namespace in other branches
  1. 7 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.

File

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));
}