function social_group_allowed_visibility_description in Open Social 10.1.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_group/social_group.module \social_group_allowed_visibility_description()
- 10.0.x modules/social_features/social_group/social_group.module \social_group_allowed_visibility_description()
- 10.2.x modules/social_features/social_group/social_group.module \social_group_allowed_visibility_description()
Returns a description array for the field_flexible_group_visibility options.
Parameters
string $key: The join method key.
Return value
string The render array containing the description.
3 calls to social_group_allowed_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_preprocess_fieldset in modules/
social_features/ social_group/ social_group.module - Implements template_preprocess_form_element().
- _social_group_get_allowed_visibility in modules/
social_features/ social_group/ social_group.module - Get the allowed visibility of a group.
File
- modules/
social_features/ social_group/ social_group.module, line 2709 - The Social group module.
Code
function social_group_allowed_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':
// If we want to have the title, lets start with it, otherwise open our
// paragraph.
$description = '<p>';
$description .= '<strong><svg class="icon-small"><use xlink:href="#icon-public"></use></svg></strong>';
$description .= '<strong>' . t('Public')
->render() . '</strong>';
$description .= ' - ' . t('visible to all visitors to the platform.')
->render();
$description .= '</p>';
break;
case 'community':
// If we want to have the title, lets start with it, otherwise open our
// paragraph.
$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 visible to all logged-in users.')
->render();
$description .= '</p>';
break;
case 'group':
// If we want to have the title, lets start with it, otherwise open our
// paragraph.
$description = '<p>';
$description .= '<strong><svg class="icon-small"><use xlink:href="#icon-lock"></use></svg></strong>';
$description .= '<strong>' . t('Group members only')
->render() . '</strong>';
$description .= ' - ' . t('only visible to logged-in group members.')
->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_content_visibility_description', $key, $description);
return $description;
}