You are here

function juicebox_form_pre_render_fieldsets in Juicebox HTML5 Responsive Image Galleries 7.2

Same name and namespace in other branches
  1. 8.2 juicebox.module \juicebox_form_pre_render_fieldsets()

Form pre-render callback: visually render fieldsets without affecting tree-based variable storage.

This technique/code is taken almost directly from the Views module in views_ui_pre_render_add_fieldset_markup()

1 string reference to 'juicebox_form_pre_render_fieldsets'
JuiceboxGalleryDrupal::confBaseForm in includes/JuiceboxGalleryDrupal.inc
Get common elements for Juicebox configuration forms.

File

./juicebox.module, line 456
Provides Drupal integration with the Juicebox library. This file contains the relevant Drupal hook implementations and callbacks.

Code

function juicebox_form_pre_render_fieldsets($form) {
  foreach (element_children($form) as $key) {
    $element = $form[$key];

    // In our form builder functions, we added an arbitrary #jb_fieldset
    // property to any element that belongs in a fieldset. If this form element
    // has that property, move it into its fieldset.
    if (isset($element['#jb_fieldset']) && isset($form[$element['#jb_fieldset']])) {
      $form[$element['#jb_fieldset']][$key] = $element;

      // Remove the original element this duplicates.
      unset($form[$key]);
    }
  }
  return $form;
}