function date_api_filter_handler::value_form in Date 6
Same name and namespace in other branches
- 6.2 includes/date_api_filter_handler.inc \date_api_filter_handler::value_form()
Add the selectors to the value form using the date handler.
File
- ./
date_api.views.inc, line 581 - Defines date-related Views data and plugins:
Class
- date_api_filter_handler
- A flexible, configurable date filter.
Code
function value_form(&$form, &$form_state) {
// We use different values than the parent form, so we must
// construct our own form element.
$form['value'] = array();
$form['value']['#tree'] = TRUE;
$which = 'all';
if (!empty($form['operator'])) {
$source = $form['operator']['#type'] == 'radios' ? 'radio:options[operator]' : 'edit-options-operator';
}
if (!empty($form_state['exposed'])) {
if (empty($this->options['expose']['operator'])) {
// exposed and locked.
$which = in_array($this->operator, $this
->operator_values(2)) ? 'minmax' : 'value';
}
else {
$source = 'edit-' . form_clean_id($this->options['expose']['operator']);
}
}
$handler = $this->date_handler;
if ($which == 'all' || $which == 'value') {
$form['value'] += $this
->date_parts_form('value', $source, $which, $this
->operator_values(1));
}
if ($which == 'all' || $which == 'minmax') {
$form['value'] += $this
->date_parts_form('min', $source, $which, $this
->operator_values(2));
$form['value'] += $this
->date_parts_form('max', $source, $which, $this
->operator_values(2));
}
$form['value']['description'] = array(
'#prefix' => '<div class=""><div class="form-item"><div class="description">',
'#suffix' => '</div></div></div>',
'#value' => t('Blank values do no filtering, \'now\' filters for the current value.'),
);
if ($this->options['adjustment_field'] == 1) {
$form['value']['description']['#value'] .= t(' \'Adjustment\' filters for an offset like \'+1 day\' from the other values, most useful when used with \'now\'.');
}
elseif ($this->options['adjustment_field'] == 2) {
$form['value']['description']['#value'] = t('\'Adjustment\' filters for an offset like \'+1 day\' from the current time.');
}
}