You are here

function _date_repeat_widget in Date 7

Same name and namespace in other branches
  1. 5.2 date/date_repeat.inc \_date_repeat_widget()
  2. 6.2 date/date_repeat.inc \_date_repeat_widget()
  3. 6 date/date_repeat.inc \_date_repeat_widget()

Widget processing for date repeat form element.

Create the RRULE as a top-level element rather than a delta level element, we'll compute the repeat sequence in the widget validation to create the element delta values.

1 call to _date_repeat_widget()
date_field_widget_form in ./date_elements.inc
Private implementation of hook_widget().

File

./date_repeat.inc, line 30
Implementation of Date Repeat API calculations for the CCK Date field.

Code

function _date_repeat_widget(&$element, $field, $instance, $items, $delta) {
  $element['rrule'] = array(
    '#type' => 'date_repeat_rrule',
    '#theme_wrappers' => array(
      'date_repeat_rrule',
    ),
    '#default_value' => isset($items[0]['rrule']) ? $items[0]['rrule'] : '',
    '#date_timezone' => $element['#date_timezone'],
    '#date_format' => date_limit_format(date_input_format($element, $field, $instance), $field['settings']['granularity']),
    '#date_text_parts' => (array) $instance['widget']['settings']['text_parts'],
    '#date_increment' => $instance['widget']['settings']['increment'],
    '#date_year_range' => $instance['widget']['settings']['year_range'],
    '#date_label_position' => $instance['widget']['settings']['label_position'],
    '#prev_value' => isset($items[0]['value']) ? $items[0]['value'] : '',
    '#prev_value2' => isset($items[0]['value2']) ? $items[0]['value2'] : '',
    '#prev_rrule' => isset($items[0]['rrule']) ? $items[0]['rrule'] : '',
    '#date_repeat_widget' => str_replace('_repeat', '', $instance['widget']['type']),
    '#date_repeat_collapsed' => $instance['settings']['repeat_collapsed'],
  );
  return $element;
}