public static function FlexibleGroupContentVisibilityUpdate::calculateVisibility in Open Social 8.7
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::calculateVisibility()
- 8.6 modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::calculateVisibility()
- 8.8 modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::calculateVisibility()
- 10.3.x modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::calculateVisibility()
- 10.0.x modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::calculateVisibility()
- 10.1.x modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::calculateVisibility()
- 10.2.x modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::calculateVisibility()
Calculate the new visibility options.
Parameters
string $current_visibility: The current visibility.
array $new_options: The new options to choose from.
Return value
string The new visibility.
1 call to FlexibleGroupContentVisibilityUpdate::calculateVisibility()
- FlexibleGroupContentVisibilityUpdate::updateVisibility in modules/
social_features/ social_group/ modules/ social_group_flexible_group/ src/ FlexibleGroupContentVisibilityUpdate.php - Update visibility for all Group Content based on a new group type.
File
- modules/
social_features/ social_group/ modules/ social_group_flexible_group/ src/ FlexibleGroupContentVisibilityUpdate.php, line 213
Class
- FlexibleGroupContentVisibilityUpdate
- Class FlexibleGroupContentVisibilityUpdate.
Namespace
Drupal\social_group_flexible_groupCode
public static function calculateVisibility($current_visibility, array $new_options) {
// If there is only one option just return that one.
if (count($new_options) === 1) {
return $new_options[0]['value'];
}
$visibility = '';
// Calculate new options based on what it was before editting.
switch ($current_visibility) {
case 'community':
$visibility = 'public';
if (array_search('group', array_column($new_options, 'value')) !== FALSE) {
$visibility = 'group';
}
break;
case 'public':
$visibility = 'group';
if (array_search('community', array_column($new_options, 'value')) !== FALSE) {
$visibility = 'community';
}
break;
case 'group':
$visibility = 'public';
if (array_search('community', array_column($new_options, 'value')) !== FALSE) {
$visibility = 'community';
}
break;
}
return $visibility;
}