function _social_group_type_edit_submit in Open Social 8.9
Same name and namespace in other branches
- 8.4 modules/social_features/social_group/social_group.module \_social_group_type_edit_submit()
- 8.5 modules/social_features/social_group/social_group.module \_social_group_type_edit_submit()
- 8.6 modules/social_features/social_group/social_group.module \_social_group_type_edit_submit()
- 8.7 modules/social_features/social_group/social_group.module \_social_group_type_edit_submit()
- 8.8 modules/social_features/social_group/social_group.module \_social_group_type_edit_submit()
- 10.3.x modules/social_features/social_group/social_group.module \_social_group_type_edit_submit()
- 10.0.x modules/social_features/social_group/social_group.module \_social_group_type_edit_submit()
- 10.1.x modules/social_features/social_group/social_group.module \_social_group_type_edit_submit()
- 10.2.x modules/social_features/social_group/social_group.module \_social_group_type_edit_submit()
Form submit for removing members from a group so we can clear caches.
Throws
\Drupal\Core\Entity\EntityStorageException
2 string references to '_social_group_type_edit_submit'
- social_group_form_alter in modules/
social_features/ social_group/ social_group.module - Implements hook_form_alter().
- social_group_secret_form_group_secret_group_edit_form_alter in modules/
social_features/ social_group/ modules/ social_group_secret/ social_group_secret.module - Implements hook_form_FORM_ID_alter().
File
- modules/
social_features/ social_group/ social_group.module, line 820 - The Social group module.
Code
function _social_group_type_edit_submit($form, FormStateInterface $form_state) {
// Check if the group_type changed.
// Visibility be empty for flexible groups.
$group = _social_group_get_current_group();
if (!empty($form['group_type']) && \Drupal::service('social_group.helper_service')
->getDefaultGroupVisibility($group
->getGroupType()
->id()) != NULL) {
$default_type = $form['group_type']['widget']['#default_value'];
$new_type = $form_state
->getValue('group_type')[0]['value'];
// Update the Group entity and all it's content when the type changed.
if ($new_type !== $default_type) {
// Update the default visibility of all the content.
GroupContentVisibilityUpdate::batchUpdateGroupContentVisibility($group, $new_type);
}
}
if ($group instanceof GroupInterface) {
// Make sure we clear cache tags accordingly.
$cache_tags = _social_group_cache_tags($group);
foreach ($cache_tags as $cache_tag) {
Cache::invalidateTags([
$cache_tag,
]);
}
}
}