public function ForwardFormBlock::isAllowed in Forward 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/Block/ForwardFormBlock.php \Drupal\forward\Plugin\Block\ForwardFormBlock::isAllowed()
- 8 src/Plugin/Block/ForwardFormBlock.php \Drupal\forward\Plugin\Block\ForwardFormBlock::isAllowed()
2 calls to ForwardFormBlock::isAllowed()
- ForwardFormBlock::blockAccess in src/
Plugin/ Block/ ForwardFormBlock.php - Indicates whether the block should be shown.
- ForwardFormBlock::build in src/
Plugin/ Block/ ForwardFormBlock.php - Builds and returns the renderable array for this block plugin.
File
- src/
Plugin/ Block/ ForwardFormBlock.php, line 155
Class
- ForwardFormBlock
- Provides a block with a Forward form.
Namespace
Drupal\forward\Plugin\BlockCode
public function isAllowed() {
$allowed = FALSE;
$entity = 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) {
$view_mode = 'full';
$this->entity = $entity;
$allowed = $this->accessChecker
->isAllowed($this->settings, $entity, $view_mode, $entity
->getEntityTypeId(), $bundle);
}
return $allowed;
}