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