function date_repeat_rrule_validate in Date 8
Same name and namespace in other branches
- 5.2 date_repeat/date_repeat_form.inc \date_repeat_rrule_validate()
- 6.2 date_repeat/date_repeat_form.inc \date_repeat_rrule_validate()
- 6 date_repeat/date_repeat_form.inc \date_repeat_rrule_validate()
- 7.3 date_repeat/date_repeat_form.inc \date_repeat_rrule_validate()
- 7 date_repeat/date_repeat_form.inc \date_repeat_rrule_validate()
- 7.2 date_repeat/date_repeat_form.inc \date_repeat_rrule_validate()
Build a RRULE out of the form values.
1 string reference to 'date_repeat_rrule_validate'
- date_repeat_element_info in date_repeat/
date_repeat.module - Implements hook_element_info().
File
- date_repeat/
date_repeat_form.inc, line 892 - Code to add a date repeat selection form to a date field and create an iCal RRULE from the chosen selections.
Code
function date_repeat_rrule_validate($element, &$form_state) {
if (date_hidden_element($element)) {
return;
}
$parents = $element['#parents'];
array_pop($parents);
$field_values = drupal_array_get_nested_value($form_state['values'], $parents);
if ($field_values['show_repeat_settings'] === 0 || $field_values['rrule']['FREQ'] === 'NONE') {
form_set_value($element, NULL, $form_state);
return;
}
// Clean the buttons off of the form. Needed to avoid errors when
// the date is used on a user object, which then passes the form
// through form_state_values_clean().
foreach ($form_state['buttons'] as $delta => $item) {
if (!empty($item['#ajax']['callback']) && in_array($item['#ajax']['callback'], array(
'date_repeat_add_exception_callback',
'date_repeat_add_addition_callback',
))) {
unset($form_state['buttons'][$delta]);
}
}
$item = drupal_array_get_nested_value($form_state['values'], $element['#parents']);
$item = date_repeat_merge($item, $element);
$rrule = DateiCalParse::build_rrule($item);
form_set_value($element, $rrule, $form_state);
}