You are here

protected function GroupHeroBlock::blockAccess in Open Social 10.0.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  2. 8 modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  3. 8.2 modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  4. 8.3 modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  5. 8.4 modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  6. 8.5 modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  7. 8.6 modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  8. 8.7 modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  9. 8.8 modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  10. 10.3.x modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  11. 10.1.x modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()
  12. 10.2.x modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php \Drupal\social_group\Plugin\Block\GroupHeroBlock::blockAccess()

Indicates whether the block should be shown.

Blocks with specific access checking should override this method rather than access(), in order to avoid repeating the handling of the $return_as_object argument.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user session for which to check access.

Return value

\Drupal\Core\Access\AccessResult The access result.

Overrides BlockPluginTrait::blockAccess

See also

self::access()

File

modules/social_features/social_group/src/Plugin/Block/GroupHeroBlock.php, line 88

Class

GroupHeroBlock
Provides a 'GroupHeroBlock' block.

Namespace

Drupal\social_group\Plugin\Block

Code

protected function blockAccess(AccountInterface $account) {
  $current_route = $this->routeMatch
    ->getRouteName();
  if ($current_route == 'entity.group_content.create_form') {
    return AccessResult::forbidden();
  }
  return parent::blockAccess($account);
}