class PathProcessorFront

Processes the inbound path by resolving it to the front page if empty.

Hierarchy

Expanded class hierarchy of PathProcessorFront

1 file declares its use of PathProcessorFront
PathProcessorTest.php in drupal/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php
Contains Drupal\Tests\Core\PathProcessor\PathProcessorTest.
1 string reference to 'PathProcessorFront'
core.services.yml in drupal/core/core.services.yml
drupal/core/core.services.yml

File

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

Namespace

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

  /**
   * A config factory for retrieving required config settings.
   *
   * @var \Drupal\Core\Config\ConfigFactory
   */
  protected $config;

  /**
   * Constructs a PathProcessorFront object.
   *
   * @param Drupal\Core\Config\ConfigFactory $config
   *   A config factory for retrieving the site front page configuration.
   */
  public function __construct(ConfigFactory $config) {
    $this->config = $config;
  }

  /**
   * Implements Drupal\Core\PathProcessor\InboundPathProcessorInterface::processInbound().
   */
  public function processInbound($path, Request $request) {
    if (empty($path)) {
      $path = $this->config
        ->get('system.site')
        ->get('page.front');
      if (empty($path)) {
        $path = 'user';
      }
    }
    return $path;
  }

  /**
   * Implements Drupal\Core\PathProcessor\OutboundPathProcessorInterface::processOutbound().
   */
  public function processOutbound($path, &$options = array(), Request $request = NULL) {

    // The special path '<front>' links to the default front page.
    if ($path == '<front>') {
      $path = '';
    }
    return $path;
  }

}

Members