function date_validation_field_validation_validators in Field Validation 7
Implements hook_field_validation_validators().
This function returns an array of validators, in the validator key => options array form. Possible options:
- name (required): name of the validator
- field types (required): defines which field types can be validated by this validator. Specify 'all' to allow all types
- custom_error (optional): define whether a user can specify a custom error message upon creating the validation rule.
- custom_data (optional): define whether custom data can be added to the validation rule
- description (optional): provide a descriptive explanation about the validator
File
- date_validation/
date_validation.validators.inc, line 19 - Provides validation functionality and hooks
Code
function date_validation_field_validation_validators() {
return array(
'date_range' => array(
'name' => "Date range",
'field_types' => array(
'textfield',
'date',
),
'custom_error' => TRUE,
'custom_data' => array(
'label' => t('Date range'),
'description' => t("Validates user-entered text against a specified date range. For example: '{global}[2012-02-10 08:30:00, 2012-02-13 20:30:00]', '{year}(02-10 08:30:00, 02-13 20:30:00]', '{month}(07 08:30:00, 13 20:30:00)', '{week}(1 08:30:00, 5 20:30:00)', '{day}[08:30:00, 20:30:00)', '{hour}[10:00, 35:00]', '{minute}[00, 35]', '{global}[now, +1 month]'."),
),
'description' => t("Validates user-entered text against a specified date range.For example: '{global}[2012-02-10 08:30:00, 2012-02-13 20:30:00]', '{year}(02-10 08:30:00, 02-13 20:30:00]', '{month}(07 08:30:00, 13 20:30:00)', '{week}(1 08:30:00, 5 20:30:00)', '{day}[08:30:00, 20:30:00)', '{hour}[10:00, 35:00]', '{minute}[00, 35]', '{global}[now, +1 month]'."),
),
);
}