UrlGenerator::$decodedChars

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::decodedChars
  2. 8.9.x core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::decodedChars
  3. 10 core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::decodedChars

Overrides characters that will not be percent-encoded in the path segment.

The first two elements are the first two parameters of str_replace(), so if you override this variable you can also use arrays for the encoded and decoded characters.

Type: decodedChars

See also

\Symfony\Component\Routing\Generator\UrlGenerator

File

core/lib/Drupal/Core/Routing/UrlGenerator.php, line 63

Class

UrlGenerator
Generates URLs from route names and parameters.

Namespace

Drupal\Core\Routing

Code

protected $decodedChars = [
    // The slash can be used to designate a hierarchical structure and we want allow using it with this meaning
    // some webservers don't allow the slash in encoded form in the path for security reasons anyway
    // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss
    // Map from these encoded characters.
'%2F',
    // Map to these decoded characters.
'/',
];

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.