public function date_context_date_condition::options_form in Date 7.2
Same name and namespace in other branches
- 8 date_context/plugins/date_context_date_condition.inc \date_context_date_condition::options_form()
- 7.3 date_context/plugins/date_context_date_condition.inc \date_context_date_condition::options_form()
Options form. Provide additional options for your condition.
Overrides context_condition_node::options_form
File
- date_context/
plugins/ date_context_date_condition.inc, line 30 - Context condition plugin for date values.
Class
- date_context_date_condition
- Context condition plugin for date values.
Code
public 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'),
);
$dependency_options = array(
'<',
'<=',
'>',
'>=',
'=',
'!=',
);
$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(
'edit-conditions-plugins-date-context-date-condition-options-operation' => $dependency_options,
),
);
return $form;
}