You are here

function date_repeat_after_build in Date 7.3

Same name and namespace in other branches
  1. 8 date_repeat_field/date_repeat_field.module \date_repeat_after_build()
  2. 7.2 date_repeat_field/date_repeat_field.module \date_repeat_after_build()

Implements the form after_build().

1 string reference to 'date_repeat_after_build'
date_field_widget_form in ./date_elements.inc
Private implementation of hook_widget().

File

date_repeat_field/date_repeat_field.module, line 422
Creates the option of Repeating Date fields and manages Date Repeat fields.

Code

function date_repeat_after_build(&$element, &$form_state) {

  // Remove the 'Add more' elements from a repeating date form.
  foreach ($form_state['storage']['repeat_fields'] as $field_name => $parents) {

    // Remove unnecessary items in the form added by the Add more handling.
    $value = drupal_array_get_nested_value($element, $parents);
    $langcode = $value['#language'];
    unset($value[$langcode]['add_more'], $value[$langcode]['#suffix'], $value[$langcode]['#prefix'], $value[$langcode][0]['_weight']);
    $value[$langcode]['#cardinality'] = 1;
    $value[$langcode]['#max_delta'] = 1;
    drupal_array_set_nested_value($element, $parents, $value);
  }
  return $element;
}