Skip to content

RedirectEntityEditSubscriber

Redirect 4xx errors to the entity edit page if the user has access.


  • Full name: \Drupal\helper\EventSubscriber\RedirectEntityEditSubscriber
  • Parent class: HttpExceptionSubscriberBase

Properties

currentUser

protected \Drupal\Core\Session\AccountInterface $currentUser

routeMatch

protected \Drupal\Core\Routing\RouteMatchInterface $routeMatch

currentEntity

protected \Drupal\helper\CurrentEntity $currentEntity

Methods

__construct

Constructs a new RedirectEntityEditSubscriber.

public __construct(\Drupal\Core\Session\AccountInterface $currentUser, \Drupal\Core\Routing\RouteMatchInterface $routeMatch, \Drupal\helper\CurrentEntity $currentEntity): mixed

Parameters:

Parameter Type Description
$currentUser \Drupal\Core\Session\AccountInterface
The current user.
$routeMatch \Drupal\Core\Routing\RouteMatchInterface
The route match.
$currentEntity \Drupal\helper\CurrentEntity
The current entity service.

getHandledFormats

{@inheritdoc}

protected getHandledFormats(): mixed

getPriority

{@inheritdoc}

protected static getPriority(): mixed
  • This method is static.

on4xx

Redirects on 4xx kernel exceptions.

public on4xx(\Symfony\Component\HttpKernel\Event\ExceptionEvent $event): mixed

Parameters:

Parameter Type Description
$event \Symfony\Component\HttpKernel\Event\ExceptionEvent
The Event to process.

checkEntityEditRedirect

Checks to see if the current request can redirect to the entity edit page.

public checkEntityEditRedirect(\Symfony\Component\HttpKernel\Event\RequestEvent $event): ?\Drupal\Core\Routing\TrustedRedirectResponse

Parameters:

Parameter Type Description
$event \Symfony\Component\HttpKernel\Event\RequestEvent