function social_group_group_visibility_description in Open Social 10.2.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_group/social_group.module \social_group_group_visibility_description()
- 10.0.x modules/social_features/social_group/social_group.module \social_group_group_visibility_description()
- 10.1.x modules/social_features/social_group/social_group.module \social_group_group_visibility_description()
Returns a description array for the field_flexible_group_visibility options.
Return value
string The render array containing the description.
2 calls to social_group_group_visibility_description()
- social_group_flexible_group_preprocess_fieldset in modules/
social_features/ social_group/ modules/ social_group_flexible_group/ social_group_flexible_group.module - Implements template_preprocess_form_element().
- _social_group_get_group_visibility in modules/
social_features/ social_group/ social_group.module - Get the group visibility label of a group.
File
- modules/
social_features/ social_group/ social_group.module, line 598 - The Social group module.
Code
function social_group_group_visibility_description($key) {
$description = '';
// We need it to be specified otherwise we can't build the markup.
if (empty($key)) {
return $description;
}
// Add explanatory descriptive text after the icon.
switch ($key) {
case 'public':
$description = '<p>';
$description .= '<p><strong><svg class="icon-small"><use xlink:href="#icon-public"></use></svg></strong>';
$description .= '<strong>' . t('Public')
->render() . '</strong>';
$description .= ' - ' . t('All visitors of the platform can see this group')
->render();
$description .= '</p>';
break;
case 'community':
$description = '<p>';
$description .= '<strong><svg class="icon-small"><use xlink:href="#icon-community"></use></svg></strong>';
$description .= '<strong>' . t('Community')
->render() . '</strong>';
$description .= ' - ' . t('Only members who are logged in can see this group')
->render();
$description .= '</p>';
break;
case 'members':
$description = '<p>';
$description .= '<p><strong><svg class="icon-small"><use xlink:href="#icon-lock"></use></svg></strong>';
$description .= '<strong>' . t('Group members only (Secret)')
->render() . '</strong>';
$description .= ' - ' . t('Only group members can see this group')
->render();
$description .= '</p>';
break;
}
// Allow modules to provide their own markup for a given key in the
// group_visibility #options array.
\Drupal::moduleHandler()
->alter('social_group_group_visibility_description', $key, $description);
return $description;
}