3 namespace Drupal\Core\PathProcessor;
5 use Drupal\Core\Config\ConfigFactoryInterface;
6 use Drupal\Core\Render\BubbleableMetadata;
7 use Symfony\Component\HttpFoundation\Request;
8 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
11 * Processes the inbound path by resolving it to the front page if empty.
13 * @todo - remove ::processOutbound() when we remove UrlGenerator::fromPath().
15 class PathProcessorFront implements InboundPathProcessorInterface, OutboundPathProcessorInterface {
18 * A config factory for retrieving required config settings.
20 * @var \Drupal\Core\Config\ConfigFactoryInterface
25 * Constructs a PathProcessorFront object.
27 * @param \Drupal\Core\Config\ConfigFactoryInterface $config
28 * A config factory for retrieving the site front page configuration.
30 public function __construct(ConfigFactoryInterface $config) {
31 $this->config = $config;
37 public function processInbound($path, Request $request) {
39 $path = $this->config->get('system.site')->get('page.front');
41 // We have to return a valid path but / won't be routable and config
42 // might be broken so stop execution.
43 throw new NotFoundHttpException();
52 public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
53 // The special path '<front>' links to the default front page.
54 if ($path === '/<front>') {