public function GroupAddTopicBlock::blockAccess in Open Social 10.0.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 8 modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 8.2 modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 8.3 modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 8.4 modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 8.5 modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 8.6 modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 8.7 modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 8.8 modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 10.3.x modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 10.1.x modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
- 10.2.x modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php \Drupal\social_group\Plugin\Block\GroupAddTopicBlock::blockAccess()
Custom access logic to display the block.
Overrides BlockPluginTrait::blockAccess
File
- modules/
social_features/ social_group/ src/ Plugin/ Block/ GroupAddTopicBlock.php, line 26
Class
- GroupAddTopicBlock
- Provides a 'GroupAddTopicBlock' block.
Namespace
Drupal\social_group\Plugin\BlockCode
public function blockAccess(AccountInterface $account) {
$group = _social_group_get_current_group();
if (is_object($group)) {
if ($group
->hasPermission('create group_node:topic entity', $account) && $account
->hasPermission("create topic content")) {
if ($group
->getGroupType()
->id() === 'public_group') {
$config = \Drupal::config('entity_access_by_field.settings');
if ($config
->get('disable_public_visibility') === 1 && !$account
->hasPermission('override disabled public visibility')) {
return AccessResult::forbidden();
}
}
return AccessResult::allowed();
}
}
// By default, the block is not visible.
return AccessResult::forbidden();
}