function EntityView::access
Same name in other branches
- 8.x-3.x src/Plugin/Block/EntityView.php \Drupal\ctools\Plugin\Block\EntityView::access()
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 \Drupal\Core\Entity\EntityInterface $entity */
$entity = $this->getContextValue('entity');
return $entity->access('view', $account, $return_as_object);
}