Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UrlHelper.php

function 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.

4 calls to UrlHelper::encodePath()
ContextualLinks::render in core/modules/contextual/src/Plugin/views/field/ContextualLinks.php
Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
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.
PublicStream::getExternalUrl in core/lib/Drupal/Core/StreamWrapper/PublicStream.php
Returns a web accessible URL for the resource.

File

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

Class

UrlHelper
Helper class URL based methods.

Namespace

Drupal\Component\Utility

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal