function global_filter_set_instance_date_widget_value in Views Global Filter 8
Same name and namespace in other branches
- 7 widgets/global_filter.datewidget.inc \global_filter_set_instance_date_widget_value()
Set instance date widget value.
1 call to global_filter_set_instance_date_widget_value()
- global_filter_create_field_instance_widget in ./
global_filter.widgets.inc - Cast widget in the mould of the widget configured for the supplied's field.
File
- widgets/
global_filter.datewidget.inc, line 137 - global_filter.datewidget.inc
Code
function global_filter_set_instance_date_widget_value(&$field, $instance, &$form_state) {
$name = $field['field_name'];
$lang = $form_state['language'];
if (empty($form_state['input'][$name][$lang])) {
// If this is the first time the form is presented, tell
// global_filter_field_date_widget_form_alter() to take the date range
// from the session and convert it into a widget-compatible format.
$form_state['set_date_from_session'] = TRUE;
$items = array();
}
else {
$items = $form_state['input'][$name][$lang];
}
$form_state['field'][$name][$lang] = array(
'field' => $field,
'instance' => $instance,
'items_count' => 1,
);
// Make sure that a Date global filter always appears with an end date.
// For date_combo_element_process().
$form_state['field'][$name][$lang]['field']['settings']['todate'] = TRUE;
// For date_default_value().
$field['settings']['todate'] = TRUE;
return $items;
}