You are here

public function AccessControlHandler::blockContentAddPageAccess in Block Content Permissions 8

Access check for the block content add page.

Return value

\Drupal\Core\Access\AccessResult An access result.

File

src/AccessControlHandler.php, line 113

Class

AccessControlHandler
Controller for the block content permissions.

Namespace

Drupal\block_content_permissions

Code

public function blockContentAddPageAccess() {
  $orPermissions = [];
  foreach ($this
    ->blockContentTypes() as $bundle_type) {
    $orPermissions[] = "create {$bundle_type} block content";
  }
  $account = $this
    ->currentUser();
  return AccessResult::allowedIfHasPermissions($account, $orPermissions, 'OR');
}