private function SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess 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::removeGroupsWithoutCreateAccess()
- 8.2 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 8.3 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 8.4 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 8.5 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 8.6 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 8.7 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 8.8 modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 10.3.x modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 10.0.x modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 10.1.x modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- 10.2.x modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php \Drupal\social_group\Plugin\Field\FieldWidget\SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
Remove options from the list.
Parameters
array $options: A list of options to check.
\Drupal\user\Entity\User $account: The user to check for.
\Drupal\Core\Entity\EntityInterface $entity: The entity to check for.
Return value
array An list of options for the field containing groups with create access.
1 call to SocialGroupSelectorWidget::removeGroupsWithoutCreateAccess()
- SocialGroupSelectorWidget::getOptions in modules/
social_features/ social_group/ src/ Plugin/ Field/ FieldWidget/ SocialGroupSelectorWidget.php - Returns the array of options for the widget.
File
- modules/
social_features/ social_group/ src/ Plugin/ Field/ FieldWidget/ SocialGroupSelectorWidget.php, line 287
Class
- SocialGroupSelectorWidget
- A widget to select a group when creating an entity in a group.
Namespace
Drupal\social_group\Plugin\Field\FieldWidgetCode
private function removeGroupsWithoutCreateAccess(array $options, User $account, EntityInterface $entity) {
foreach ($options as $option_category_key => $groups_in_category) {
if (is_array($groups_in_category)) {
foreach ($groups_in_category as $gid => $group_title) {
if (!$this
->checkGroupContentCreateAccess($gid, $account, $entity)) {
unset($options[$option_category_key][$gid]);
}
}
// Remove the entire category if there are no groups for this author.
if (empty($options[$option_category_key])) {
unset($options[$option_category_key]);
}
}
else {
if (!$this
->checkGroupContentCreateAccess($option_category_key, $account, $entity)) {
unset($options[$option_category_key]);
}
}
}
return $options;
}