public function GroupAddEventBlock::blockAccess in Open Social 10.2.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 8 modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 8.2 modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 8.3 modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 8.4 modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 8.5 modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 8.6 modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 8.7 modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 8.8 modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 10.3.x modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 10.0.x modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
- 10.1.x modules/social_features/social_group/src/Plugin/Block/GroupAddEventBlock.php \Drupal\social_group\Plugin\Block\GroupAddEventBlock::blockAccess()
Custom access logic to display the block.
Overrides BlockPluginTrait::blockAccess
File
- modules/
social_features/ social_group/ src/ Plugin/ Block/ GroupAddEventBlock.php, line 26
Class
- GroupAddEventBlock
- Provides a 'GroupAddEventBlock' 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:event entity', $account) && $account
->hasPermission("create event 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();
}