Skip to content

Drupal\helper\EventSubscriber\RedirectEntityEditSubscriber

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

Implements:

Symfony\Component\EventDispatcher\EventSubscriberInterface

Extend:

Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase

Methods

Name Description
__construct Constructs a new RedirectEntityEditSubscriber.
checkEntityEditRedirect Checks to see if the current request can redirect to the entity edit page.
on4xx Redirects on 4xx kernel exceptions.

Inherited methods

Name Description
getSubscribedEvents Registers the methods in this class that should be listeners.
onException Handles errors for this subscriber.

RedirectEntityEditSubscriber::__construct

Description

public __construct (\Drupal\Core\Session\AccountInterface $currentUser, \Drupal\helper\CurrentEntity $currentEntity, \Drupal\Core\Config\ConfigFactoryInterface $configFactory)

Constructs a new RedirectEntityEditSubscriber.

Parameters

  • (\Drupal\Core\Session\AccountInterface) $currentUser :
    The current user.
  • (\Drupal\helper\CurrentEntity) $currentEntity :
    The current entity service.
  • (\Drupal\Core\Config\ConfigFactoryInterface) $configFactory :
    The configuration factory.

Return Values

void


RedirectEntityEditSubscriber::checkEntityEditRedirect

Description

public checkEntityEditRedirect (void)

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

Parameters

This function has no parameters.

Return Values

void


RedirectEntityEditSubscriber::on4xx

Description

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

Redirects on 4xx kernel exceptions.

Parameters

  • (\Symfony\Component\HttpKernel\Event\ExceptionEvent) $event :
    The Event to process.

Return Values

void