You are here

function social_group_flexible_group_preprocess_fieldset in Open Social 10.2.x

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

Implements template_preprocess_form_element().

File

modules/social_features/social_group/modules/social_group_flexible_group/social_group_flexible_group.module, line 401
The Social Group Flexible Group module.

Code

function social_group_flexible_group_preprocess_fieldset(&$variables) {

  // Make sure our flexible group visibility field renders a tooltip, since
  // this field is rendered as fieldset with legend and radios as children
  // we need to do it in this preprocess.
  $element = $variables['element'];
  if (!empty($element['#field_name'])) {
    if ($element['#field_name'] === 'field_flexible_group_visibility') {
      $description = '';
      foreach ($element['#options'] as $key => $label) {
        $description .= social_group_group_visibility_description($key);
      }

      // Render a specific tooltip based on a field name and description.
      // This is done in the fieldset, next to the <legend>.
      $variables['popover'] = social_group_render_tooltip('field_flexible_group_visibility', t('Group Visibility'), $description);
    }
    if ($element['#field_name'] === 'field_group_allowed_visibility') {
      $description = '';
      foreach ($element['#options'] as $key => $label) {
        $description .= social_group_allowed_visibility_description($key);
      }

      // Render a specific tooltip based on a field name and description.
      // This is done in the fieldset, next to the <legend>.
      $variables['popover'] = social_group_render_tooltip('field_group_allowed_visibility', t('Group content visibility'), $description);
    }
    if ($element['#field_name'] === 'field_group_allowed_join_method') {
      $description = '';
      foreach ($element['#options'] as $key => $label) {
        $description .= social_group_allowed_join_method_description($key);
      }

      // Render a specific tooltip based on a field name and description.
      // This is done in the fieldset, next to the <legend>.
      $variables['popover'] = social_group_render_tooltip('field_group_allowed_join_method', t('Join methods'), $description);
    }
  }
}