function drupal_encode_path

Encodes a Drupal path for use in a URL.

For aesthetic reasons slashes are not escaped.

Note that url() takes care of calling this function, so a path passed to that function should not be encoded in advance.

Parameters

$path: The Drupal path to encode.

Related topics

4 calls to drupal_encode_path()
ContextualLinks::render in drupal/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php
Render the contextual fields.
FieldWebTest::testAlterUrl in drupal/core/modules/views/lib/Drupal/views/Tests/Handler/FieldWebTest.php
Tests rewriting the output to a link.
file_create_url in drupal/core/includes/file.inc
Creates a web-accessible URL for a stream to an external or local file.
PublicStream::getExternalUrl in drupal/core/lib/Drupal/Core/StreamWrapper/PublicStream.php
Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl().

File

drupal/core/includes/common.inc, line 636
Common functions that many Drupal modules will need to reference.

Code

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