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