function AccessDeniedSubscriber::getPriority

Specifies the priority of all listeners in this class.

The default priority is 1, which is very low. To have listeners that have a "first attempt" at handling exceptions return a higher priority.

Return value

int The event priority of this subscriber.

Overrides HttpExceptionSubscriberBase::getPriority

File

core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php, line 49

Class

AccessDeniedSubscriber
Redirects users when access is denied.

Namespace

Drupal\user\EventSubscriber

Code

protected static function getPriority() : int {
  // Use a higher priority than ExceptionLoggingSubscriber, because there's
  // no need to log the exception if we can redirect.
  // @see Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber
  return 75;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.