function rules_data_type_date::get_default_input_form in Rules 6
Gets the input form for the data Implement it, if your data is not identifiable.
Overrides rules_data_type_string::get_default_input_form
File
- rules/
modules/ rules.rules.inc, line 87 - rules integration for the rules module
Class
- rules_data_type_date
- Rules date data type
Code
function get_default_input_form($info, $value, &$form_state) {
$info += array(
'long' => FALSE,
'required' => TRUE,
'description' => '',
);
$value = isset($value) ? $value : gmdate('Y-m-d H:i:s', time());
$info['description'] = $info['description'] . ' ' . t('Format: %format or other values in GMT known by the PHP !strtotime function like "+1 day". ', array(
'%format' => gmdate('Y-m-d H:i:s', time() + 86400),
'!strtotime' => l('strtotime()', 'http://php.net/strtotime'),
));
$info['description'] .= '<br />' . t('You may also enter a timestamp in GMT. E.g. use !code together with the PHP input evalutor to specify a date one day after the evaluation time. ', array(
'!code' => '<pre>' . check_plain('<?php echo time() + 86400 * 1; ?>') . '</pre>',
));
return array(
'#type' => $info['long'] ? 'textarea' : 'textfield',
'#title' => $info['label'],
'#description' => $info['description'],
'#required' => $info['required'],
'#default_value' => $value,
);
}