You are here

function date_field_ui_field_edit_form_pre_render in Date 8

Same name and namespace in other branches
  1. 7.3 date.module \date_field_ui_field_edit_form_pre_render()
  2. 7.2 date.module \date_field_ui_field_edit_form_pre_render()

Rearrange form elements into fieldsets for presentation only.

1 string reference to 'date_field_ui_field_edit_form_pre_render'
date_form_field_ui_field_edit_form_alter in ./date.module
Implements hook_form_FORM_ID_alter() for field_ui_field_edit_form().

File

./date.module, line 374
Defines date/time field types.

Code

function date_field_ui_field_edit_form_pre_render($form) {
  foreach ($form as $name => $element) {
    if (is_array($element) && isset($element['#fieldset'])) {
      $fieldset = $element['#fieldset'];
      $form[$fieldset][$name] = $element;
      unset($form[$name]);
    }
  }
  foreach (array(
    'date_format',
    'default_values',
    'years_back_and_forward',
  ) as $name) {
    if (element_children($form[$name])) {

      // Force the items in the fieldset to be resorted now that the instance
      // and widget settings are combined.
      $form[$name]['#sorted'] = FALSE;
      $form['defaults'][$name] = $form[$name];
    }
    unset($form[$name]);
  }
  return $form;
}