class PathProcessorAlias

Processes the inbound path using path alias lookups.

Hierarchy

Expanded class hierarchy of PathProcessorAlias

2 files declare their use of PathProcessorAlias
PathProcessorTest.php in drupal/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php
Contains Drupal\Tests\Core\PathProcessor\PathProcessorTest.
UrlGeneratorTest.php in drupal/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
Contains Drupal\Tests\Core\Routing\UrlGeneratorTest.
1 string reference to 'PathProcessorAlias'
core.services.yml in drupal/core/core.services.yml
drupal/core/core.services.yml

File

drupal/core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php, line 16
Contains \Drupal\Core\PathProcessor\PathProcessorAlias.

Namespace

Drupal\Core\PathProcessor
View source
class PathProcessorAlias implements InboundPathProcessorInterface, OutboundPathProcessorInterface {

  /**
   * An alias manager for looking up the system path.
   *
   * @var \Drupal\Core\Path\AliasManagerInterface
   */
  protected $aliasManager;

  /**
   * Constructs a PathProcessorAlias object.
   *
   * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager
   *   An alias manager for looking up the system path.
   */
  public function __construct(AliasManagerInterface $alias_manager) {
    $this->aliasManager = $alias_manager;
  }

  /**
   * Implements Drupal\Core\PathProcessor\InboundPathProcessorInterface::processInbound().
   */
  public function processInbound($path, Request $request) {
    $path = $this->aliasManager
      ->getSystemPath($path);
    return $path;
  }

  /**
   * Implements Drupal\Core\PathProcessor\OutboundPathProcessorInterface::processOutbound().
   */
  public function processOutbound($path, &$options = array(), Request $request = NULL) {
    $langcode = isset($options['language']) ? $options['language']->langcode : NULL;
    $path = $this->aliasManager
      ->getPathAlias($path, $langcode);
    return $path;
  }

}

Members