You are here

public function EntityBlockBlock::blockAccess in Entityblock 8

Implements \Drupal\block\BlockBase::access().

Overrides BlockPluginTrait::blockAccess

File

src/Plugin/Block/EntityBlockBlock.php, line 215
Contains \Drupal\entityblock\Plugin\Block\EntityBlockBlock.

Class

EntityBlockBlock
Provides an entityblock block.

Namespace

Drupal\entityblock\Plugin\Block

Code

public function blockAccess(AccountInterface $account) {
  if ($account
    ->hasPermission('access content')) {
    $entity = $this
      ->loadEntity();
    if ($entity) {
      return $entity
        ->access('view', $account, TRUE);
    }
    return AccessResult::forbidden();
  }
}