PathProcessorAlias.php in Zircon Profile 8.0
File
core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php
View source
<?php
namespace Drupal\Core\PathProcessor;
use Drupal\Core\Path\AliasManagerInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Symfony\Component\HttpFoundation\Request;
class PathProcessorAlias implements InboundPathProcessorInterface, OutboundPathProcessorInterface {
protected $aliasManager;
public function __construct(AliasManagerInterface $alias_manager) {
$this->aliasManager = $alias_manager;
}
public function processInbound($path, Request $request) {
$path = $this->aliasManager
->getPathByAlias($path);
return $path;
}
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;
}
}