function date_context_date_condition::options_form in Date 8
Same name and namespace in other branches
- 7.3 date_context/plugins/date_context_date_condition.inc \date_context_date_condition::options_form()
- 7.2 date_context/plugins/date_context_date_condition.inc \date_context_date_condition::options_form()
File
- date_context/
plugins/ date_context_date_condition.inc, line 21
Class
- date_context_date_condition
- Expose term views/term forms by vocabulary as a context condition.
Code
function options_form($context) {
$defaults = $this
->fetch_from_context($context, 'options');
$options = array(
'<' => t('Is less than'),
'<=' => t('Is less than or equal to'),
'>=' => t('Is greater than or equal to'),
'>' => t('Is greater than'),
'=' => t('Is equal to'),
'!=' => t('Is not equal to'),
'empty' => t('Is empty'),
'not empty' => t('Is not Empty'),
);
$form['operation'] = array(
'#title' => t('Operation'),
'#type' => 'select',
'#options' => $options,
'#description' => t('The comparison to perform to determine if the date field meets the condition. For multiple value date fields, all values will be checked to see if any meet the condition.'),
'#default_value' => isset($defaults['operation']) ? $defaults['operation'] : '',
'#required' => TRUE,
);
$form['value'] = array(
'#title' => t('Value'),
'#type' => 'textfield',
'#description' => t("The value the field should contain to meet the condition. This can either be an absolute date in ISO format (YYYY-MM-DDTHH:MM:SS) or a relative string like '12AM today'. Examples: 2011-12-31T00:00:00, now, now +1 day, 12AM today, Monday next week. <a href=\"@relative_format\">More examples of relative date formats in the PHP documentation</a>.", array(
'@relative_format' => 'http://www.php.net/manual/en/datetime.formats.relative.php',
)),
'#default_value' => isset($defaults['value']) ? $defaults['value'] : '',
'#process' => array(
'ctools_dependent_process',
),
'#dependency' => array(
':input[name="conditions[plugins][date_context_date_condition][options][operation]"]' => array(
'<',
'<=',
'>',
'>=',
'=',
'!=',
),
),
);
return $form;
}