You are here

function social_group_allowed_join_method_description in Open Social 10.3.x

Same name and namespace in other branches
  1. 10.0.x modules/social_features/social_group/social_group.module \social_group_allowed_join_method_description()
  2. 10.1.x modules/social_features/social_group/social_group.module \social_group_allowed_join_method_description()
  3. 10.2.x modules/social_features/social_group/social_group.module \social_group_allowed_join_method_description()

Returns a description array for the field_group_allowed_join_method options.

Parameters

string $key: The join method key.

Return value

string The render array containing the description.

2 calls to social_group_allowed_join_method_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_join_methods in modules/social_features/social_group/social_group.module
Get the join methods of a group.

File

modules/social_features/social_group/social_group.module, line 649
The Social group module.

Code

function social_group_allowed_join_method_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 'added':
      $description = '<p><strong>' . t('Invite only')
        ->render() . '</strong>';
      $description .= ' - ' . t('users can only join this group if they are added/invited by group managers.')
        ->render();
      $description .= '</p>';
      break;
    case 'direct':
      $description = '<p><strong>' . t('Open to join')
        ->render() . '</strong>';
      $description .= ' - ' . t('users can join this group without approval.')
        ->render();
      $description .= '</p>';
      break;
    case 'request':
      $description = '<p><strong>' . t('Request to join')
        ->render() . '</strong>';
      $description .= ' - ' . t('users can "request to join" this group which group managers approve/decline.')
        ->render();
      $description .= '</p>';
      break;
  }

  // Allow modules to provide their own markup for a given key in the
  // join method #options array.
  \Drupal::moduleHandler()
    ->alter('social_group_allowed_join_method_description', $key, $description);
  return $description;
}