function bat_event_validate_hex_color in Booking and Availability Management Tools for Drupal 7
Utility function to validate hex color numbers.
2 string references to 'bat_event_validate_hex_color'
- bat_event_states_edit_event_form in modules/
bat_event/ bat_event.module - Form to allow user to edit a single event.
- bat_event_states_form in modules/
bat_event/ bat_event.module - Implements form that handles the definition of states for fixed state events.
File
- modules/
bat_event/ bat_event.module, line 2321 - Manage Events - Events store the EventValue of a Unit over a period of time.
Code
function bat_event_validate_hex_color($element, &$form_state) {
if (!preg_match('/^#[a-f0-9]{6}$/i', $element['#value'])) {
form_error($element, t('This is not a valid hexadecimal color!'));
}
}