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