public function ForwardLinkBlock::isAllowed in Forward 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/Block/ForwardLinkBlock.php \Drupal\forward\Plugin\Block\ForwardLinkBlock::isAllowed()
- 8 src/Plugin/Block/ForwardLinkBlock.php \Drupal\forward\Plugin\Block\ForwardLinkBlock::isAllowed()
2 calls to ForwardLinkBlock::isAllowed()
- ForwardLinkBlock::blockAccess in src/
Plugin/ Block/ ForwardLinkBlock.php - Indicates whether the block should be shown.
- ForwardLinkBlock::build in src/
Plugin/ Block/ ForwardLinkBlock.php - Builds and returns the renderable array for this block plugin.
File
- src/
Plugin/ Block/ ForwardLinkBlock.php, line 156
Class
- ForwardLinkBlock
- Provides a block with a Forward link.
Namespace
Drupal\forward\Plugin\BlockCode
public function isAllowed() {
$allowed = FALSE;
$entity = NULL;
$bundle = NULL;
$parameters = $this->routeMatch
->getParameters();
if ($parameters
->has('node')) {
$entity = $parameters
->get('node');
$bundle = $entity
->bundle();
}
if ($parameters
->has('commerce_product')) {
$entity = $parameters
->get('commerce_product');
$bundle = $entity
->bundle();
}
if ($parameters
->has('taxonomy_term')) {
$entity = $parameters
->get('taxonomy_term');
$bundle = $entity
->bundle();
}
if ($parameters
->has('user')) {
$entity = $parameters
->get('user');
$bundle = '';
}
if ($entity && $entity instanceof EntityInterface) {
$view_mode = 'full';
$this->entity = $entity;
$allowed = $this->accessChecker
->isAllowed($this->settings, $entity, $view_mode, $entity
->getEntityTypeId(), $bundle);
}
return $allowed;
}