You are here

function juicebox_form_pre_render_fieldsets in Juicebox HTML5 Responsive Image Galleries 8.2

Same name and namespace in other branches
  1. 7.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 D7 Views module in views_ui_pre_render_add_fieldset_markup()

1 string reference to 'juicebox_form_pre_render_fieldsets'
JuiceboxFormatter::confBaseForm in src/JuiceboxFormatter.php
Get common elements for Juicebox configuration forms.

File

./juicebox.module, line 207
Module file for Juicebox.

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;
}