function AccessGroupAnd::access

Same name in other branches
  1. 9 core/modules/block_content/src/Access/AccessGroupAnd.php \Drupal\block_content\Access\AccessGroupAnd::access()
  2. 10 core/modules/block_content/src/Access/AccessGroupAnd.php \Drupal\block_content\Access\AccessGroupAnd::access()
  3. 11.x core/modules/block_content/src/Access/AccessGroupAnd.php \Drupal\block_content\Access\AccessGroupAnd::access()

Overrides AccessibleInterface::access

File

core/modules/block_content/src/Access/AccessGroupAnd.php, line 34

Class

AccessGroupAnd
An access group where all the dependencies must be allowed.

Namespace

Drupal\block_content\Access

Code

public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
    $access_result = AccessResult::neutral();
    foreach (array_slice($this->dependencies, 1) as $dependency) {
        $access_result = $access_result->andIf($dependency->access($operation, $account, TRUE));
    }
    return $return_as_object ? $access_result : $access_result->isAllowed();
}

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