public function GroupAddBlock::blockAccess in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 8.2 modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 8.3 modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 8.4 modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 8.5 modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 8.6 modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 8.7 modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 8.8 modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 10.3.x modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 10.0.x modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 10.1.x modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
- 10.2.x modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php \Drupal\social_group\Plugin\Block\GroupAddBlock::blockAccess()
Custom access logic to display the block.
Overrides BlockPluginTrait::blockAccess
File
- modules/
social_features/ social_group/ src/ Plugin/ Block/ GroupAddBlock.php, line 26
Class
- GroupAddBlock
- Provides a 'GroupAddBlock' block.
Namespace
Drupal\social_group\Plugin\BlockCode
public function blockAccess(AccountInterface $account) {
$current_user = \Drupal::currentUser();
$route_user_id = \Drupal::routeMatch()
->getParameter('user');
// Show this block only on current user Groups page.
if ($current_user
->id() == $route_user_id) {
return AccessResult::allowed();
}
// By default, the block is not visible.
return AccessResult::forbidden();
}