private function SocialGroupSelectorWidget::checkGroupContentCreateAccess in Open Social 8.9
Same name and namespace in other branches
- 8 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 8.2 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 8.3 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 8.4 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 8.5 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 8.6 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 8.7 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 8.8 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 10.3.x modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 10.0.x modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 10.1.x modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- 10.2.x modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::checkGroupContentCreateAccess()
Check if user may create content of bundle in group.
Parameters
int $gid: Group id.
\Drupal\user\Entity\User $account: The user to check for.
\Drupal\Core\Entity\EntityInterface $entity: The node bundle to check for.
Return value
int Either TRUE or FALSE.
1 call to SocialGroupSelectorWidget::checkGroupContentCreateAccess()
- SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess in modules/
social_features/ social_group/ src/ Plugin/ Field/ FieldWidget/ SocialGroupSelectorWidget.php - Remove options from the list.
File
- modules/
social_features/ social_group/ src/ Plugin/ Field/ FieldWidget/ SocialGroupSelectorWidget.php, line 324
Class
- SocialGroupSelectorWidget
- A widget to select a group when creating an entity in a group.
Namespace
Drupal\social_group\Plugin\Field\FieldWidgetCode
private function checkGroupContentCreateAccess($gid, User $account, EntityInterface $entity) {
$group = Group::load($gid);
if ($group
->hasPermission('create group_' . $entity
->getEntityTypeId() . ':' . $entity
->bundle() . ' entity', $account)) {
if ($group
->getGroupType()
->id() === 'public_group') {
$config = $this->configFactory
->get('entity_access_by_field.settings');
if ($config
->get('disable_public_visibility') === 1 && !$account
->hasPermission('override disabled public visibility')) {
return FALSE;
}
}
return TRUE;
}
return FALSE;
}