class CustomPageExceptionHtmlSubscriber in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber
Exception subscriber for handling core custom HTML error pages.
Hierarchy
- class \Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase implements EventSubscriberInterface
- class \Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber
- class \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber
- class \Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber
Expanded class hierarchy of CustomPageExceptionHtmlSubscriber
1 file declares its use of CustomPageExceptionHtmlSubscriber
- CustomPageExceptionHtmlSubscriberTest.php in core/
tests/ Drupal/ Tests/ Core/ EventSubscriber/ CustomPageExceptionHtmlSubscriberTest.php - Contains \Drupal\Tests\Core\EventSubscriber\CustomPageExceptionHtmlSubscriberTest.
1 string reference to 'CustomPageExceptionHtmlSubscriber'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses CustomPageExceptionHtmlSubscriber
File
- core/
lib/ Drupal/ Core/ EventSubscriber/ CustomPageExceptionHtmlSubscriber.php, line 21 - Contains \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber.
Namespace
Drupal\Core\EventSubscriberView source
class CustomPageExceptionHtmlSubscriber extends DefaultExceptionHtmlSubscriber {
/**
* The configuration factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The page alias manager.
*
* @var \Drupal\Core\Path\AliasManagerInterface
*/
protected $aliasManager;
/**
* Constructs a new CustomPageExceptionHtmlSubscriber.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The configuration factory.
* @param \Drupal\Core\Path\AliasManagerInterface $alias_manager
* The alias manager service.
* @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
* The HTTP Kernel service.
* @param \Psr\Log\LoggerInterface $logger
* The logger service.
* @param \Drupal\Core\Routing\RedirectDestinationInterface $redirect_destination
* The redirect destination service.
*/
public function __construct(ConfigFactoryInterface $config_factory, AliasManagerInterface $alias_manager, HttpKernelInterface $http_kernel, LoggerInterface $logger, RedirectDestinationInterface $redirect_destination) {
parent::__construct($http_kernel, $logger, $redirect_destination);
$this->configFactory = $config_factory;
$this->aliasManager = $alias_manager;
}
/**
* {@inheritdoc}
*/
protected static function getPriority() {
return -50;
}
/**
* {@inheritdoc}
*/
public function on403(GetResponseForExceptionEvent $event) {
$path = $this->aliasManager
->getPathByAlias($this->configFactory
->get('system.site')
->get('page.403'));
$this
->makeSubrequest($event, trim($path, '/'), Response::HTTP_FORBIDDEN);
}
/**
* {@inheritdoc}
*/
public function on404(GetResponseForExceptionEvent $event) {
$path = $this->aliasManager
->getPathByAlias($this->configFactory
->get('system.site')
->get('page.404'));
$this
->makeSubrequest($event, trim($path, '/'), Response::HTTP_NOT_FOUND);
}
}