function BlockContentBlock::blockAccess

Same name and namespace in other branches
  1. 11.x core/modules/block_content/src/Plugin/Block/BlockContentBlock.php \Drupal\block_content\Plugin\Block\BlockContentBlock::blockAccess()
  2. 10 core/modules/block_content/src/Plugin/Block/BlockContentBlock.php \Drupal\block_content\Plugin\Block\BlockContentBlock::blockAccess()
  3. 8.9.x core/modules/block_content/src/Plugin/Block/BlockContentBlock.php \Drupal\block_content\Plugin\Block\BlockContentBlock::blockAccess()

File

core/modules/block_content/src/Plugin/Block/BlockContentBlock.php, line 175

Class

BlockContentBlock
Defines a generic custom block type.

Namespace

Drupal\block_content\Plugin\Block

Code

protected function blockAccess(AccountInterface $account) {
  if ($this->getEntity()) {
    return $this->getEntity()
      ->access('view', $account, TRUE);
  }
  return AccessResult::forbidden();
}

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