You are here

function _juicebox_form_pre_render_add_fieldset_markup in Juicebox HTML5 Responsive Image Galleries 7

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()

See also

_juicebox_common_form_elements()

1 string reference to '_juicebox_form_pre_render_add_fieldset_markup'
_juicebox_common_form_elements in ./juicebox.module
Helper to add common elements to Juicebox configuration forms.

File

./juicebox.module, line 796
Provides Drupal integration with the Juicebox library.

Code

function _juicebox_form_pre_render_add_fieldset_markup($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;
}