function _social_group_visibility_settings_submit in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 8 modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 8.2 modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 8.3 modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 8.4 modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 8.6 modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 8.7 modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 8.8 modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 10.3.x modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 10.0.x modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 10.1.x modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
- 10.2.x modules/social_features/social_group/social_group.module \_social_group_visibility_settings_submit()
Form submit for visibility settings.
Parameters
array $form: Group add or group edit form.
\Drupal\Core\Form\FormStateInterface $form_state: Form state interface.
1 string reference to '_social_group_visibility_settings_submit'
- social_group_form_entity_access_by_field_visibility_form_alter in modules/
social_features/ social_group/ social_group.module - Implements hook_form_FORM_ID_alter().
File
- modules/
social_features/ social_group/ social_group.module, line 148 - The Social group module.
Code
function _social_group_visibility_settings_submit(array $form, FormStateInterface $form_state) {
/** @var \Drupal\user\Entity\Role $role */
$role = Role::load('authenticated');
$current_permission = $role
->hasPermission('create public_group group');
$disable_public_visibility = $form_state
->getValue('disable_public_visibility');
if ($disable_public_visibility === 1 && $current_permission === TRUE) {
user_role_revoke_permissions($role
->id(), [
'create public_group group',
]);
}
if ($disable_public_visibility === 0 && $current_permission === FALSE) {
user_role_grant_permissions($role
->id(), [
'create public_group group',
]);
}
}