You are here

class PageAccessCheck in Page Manager 8.4

Same name and namespace in other branches
  1. 8 src/Entity/PageAccessCheck.php \Drupal\page_manager\Entity\PageAccessCheck

Mimics the generic entity access but with a custom key to prevent collisions.

Hierarchy

Expanded class hierarchy of PageAccessCheck

1 string reference to 'PageAccessCheck'
page_manager.services.yml in ./page_manager.services.yml
page_manager.services.yml
1 service uses PageAccessCheck
page_manager.page_access_check in ./page_manager.services.yml
Drupal\page_manager\Entity\PageAccessCheck

File

src/Entity/PageAccessCheck.php, line 13

Namespace

Drupal\page_manager\Entity
View source
class PageAccessCheck extends EntityAccessCheck {

  /**
   * {@inheritdoc}
   */
  public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {

    // Backup the original requirements.
    $original_requirements = $route
      ->getRequirements();

    // Replace it with our entity access value and run the parent access check.
    $route
      ->setRequirement('_entity_access', $route
      ->getRequirement('_page_access'));
    $access = parent::access($route, $route_match, $account);

    // Restore the original requirements.
    $route
      ->setRequirements($original_requirements);
    return $access;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PageAccessCheck::access public function Checks access to the entity operation on the given route. Overrides EntityAccessCheck::access