You are here

function social_event_preprocess_fieldset in Open Social 10.0.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_event/social_event.module \social_event_preprocess_fieldset()
  2. 10.1.x modules/social_features/social_event/social_event.module \social_event_preprocess_fieldset()
  3. 10.2.x modules/social_features/social_event/social_event.module \social_event_preprocess_fieldset()

Implements template_preprocess_form_element().

File

modules/social_features/social_event/social_event.module, line 1231
The Social event module.

Code

function social_event_preprocess_fieldset(&$variables) {

  // Make sure our event enroll method 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_enroll_method') {
      $description = '';
      foreach ($element['#options'] as $key => $label) {
        $description .= social_event_enroll_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_event_render_tooltip('field_enroll_method', t('Enroll method'), $description);
    }
  }
}