public function ForwardLinkBlock::isAllowed in Forward 8
Same name and namespace in other branches
- 8.3 src/Plugin/Block/ForwardLinkBlock.php \Drupal\forward\Plugin\Block\ForwardLinkBlock::isAllowed()
 - 8.2 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 124  - Contains \Drupal\forward\Plugin\Block\ForwardLinkBlock.
 
Class
- ForwardLinkBlock
 - Provides a block for switching users.
 
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('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;
}