You are here

function vertical_tabs_get_form_elements in Vertical Tabs 6

Get all the fieldset elements from a form.

3 calls to vertical_tabs_get_form_elements()
vertical_tabs_add_node_type_options in ./vertical_tabs.admin.inc
vertical_tabs_add_vertical_tabs in ./vertical_tabs.module
Add a vertical tab form element to a form.
vertical_tabs_form_configure in ./vertical_tabs.module

File

./vertical_tabs.module, line 273
Provides vertical tabs capability for fieldsets in forms.

Code

function vertical_tabs_get_form_elements(&$form) {
  $elements = array();
  foreach (element_children($form) as $key) {
    if (!isset($form[$key]['#type'])) {

      // Ignore non-type elements.
      continue;
    }
    elseif (!in_array($form[$key]['#type'], array(
      'fieldset',
    ))) {

      // Ignore non-fieldset elements.
      continue;
    }
    elseif (isset($form[$key]['#access']) && !$form[$key]['#access']) {

      // Ignore elements the user cannot access.
      continue;
    }
    $elements[$key] =& $form[$key];
  }
  return $elements;
}