protected function SocialInviteLocalActionsBlock::blockAccess in Open Social 10.1.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/modules/social_group_invite/src/Plugin/Block/SocialInviteLocalActionsBlock.php \Drupal\social_group_invite\Plugin\Block\SocialInviteLocalActionsBlock::blockAccess()
- 10.3.x modules/social_features/social_group/modules/social_group_invite/src/Plugin/Block/SocialInviteLocalActionsBlock.php \Drupal\social_group_invite\Plugin\Block\SocialInviteLocalActionsBlock::blockAccess()
- 10.0.x modules/social_features/social_group/modules/social_group_invite/src/Plugin/Block/SocialInviteLocalActionsBlock.php \Drupal\social_group_invite\Plugin\Block\SocialInviteLocalActionsBlock::blockAccess()
- 10.2.x modules/social_features/social_group/modules/social_group_invite/src/Plugin/Block/SocialInviteLocalActionsBlock.php \Drupal\social_group_invite\Plugin\Block\SocialInviteLocalActionsBlock::blockAccess()
Indicates whether the block should be shown.
Blocks with specific access checking should override this method rather than access(), in order to avoid repeating the handling of the $return_as_object argument.
Parameters
\Drupal\Core\Session\AccountInterface $account: The user session for which to check access.
Return value
\Drupal\Core\Access\AccessResult The access result.
Overrides BlockPluginTrait::blockAccess
See also
File
- modules/
social_features/ social_group/ modules/ social_group_invite/ src/ Plugin/ Block/ SocialInviteLocalActionsBlock.php, line 75
Class
- SocialInviteLocalActionsBlock
- Provides a 'SocialInviteLocalActionsBlock' block.
Namespace
Drupal\social_group_invite\Plugin\BlockCode
protected function blockAccess(AccountInterface $account) {
$group = _social_group_get_current_group();
if ($group instanceof GroupInterface) {
// If group allows Group Invites by content plugin and user has access.
if (_social_group_invite_current_type_enabled_invites() && $group
->hasPermission('invite users to group', $account)) {
return AccessResult::allowed();
}
}
return AccessResult::forbidden();
}