You are here

class PathProcessorAlias in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php \Drupal\Core\PathProcessor\PathProcessorAlias

Processes the inbound path using path alias lookups.

Hierarchy

Expanded class hierarchy of PathProcessorAlias

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

File

core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php, line 17
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;
  }

  /**
   * {@inheritdoc}
   */
  public function processInbound($path, Request $request) {
    $path = $this->aliasManager
      ->getPathByAlias($path);
    return $path;
  }

  /**
   * {@inheritdoc}
   */
  public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
    if (empty($options['alias'])) {
      $langcode = isset($options['language']) ? $options['language']
        ->getId() : NULL;
      $path = $this->aliasManager
        ->getAliasByPath($path, $langcode);
    }
    return $path;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PathProcessorAlias::$aliasManager protected property An alias manager for looking up the system path.
PathProcessorAlias::processInbound public function Processes the inbound path. Overrides InboundPathProcessorInterface::processInbound
PathProcessorAlias::processOutbound public function Processes the outbound path. Overrides OutboundPathProcessorInterface::processOutbound
PathProcessorAlias::__construct public function Constructs a PathProcessorAlias object.