public function EntityView::access in Chaos Tool Suite (ctools) 8.3
Overrides BlockPluginTrait::access
File
- src/
Plugin/ Block/ EntityView.php, line 105
Class
- EntityView
- Provides a block to view a specific entity.
Namespace
Drupal\ctools\Plugin\BlockCode
public function access(AccountInterface $account, $return_as_object = FALSE) {
// Check the parent's access.
$parent_access = parent::access($account, TRUE);
if (!$parent_access
->isAllowed()) {
return $return_as_object ? $parent_access : $parent_access
->isAllowed();
}
/** @var $entity \Drupal\Core\Entity\EntityInterface */
$entity = $this
->getContextValue('entity');
return $entity
->access('view', $account, $return_as_object);
}