function editor_note_validate_hex in Editor Notes 7
Validates form element that accepts HEX value.
1 string reference to 'editor_note_validate_hex'
- editor_note_field_settings_form in ./
editor_note.module - Implements hook_field_settings_form().
File
- ./
editor_note.module, line 1387 - Main functionality for Editor Notes module.
Code
function editor_note_validate_hex($element, &$form_state) {
preg_match('/^[0-9A-Fa-f]{6}$/', trim($element['#value']), $matches);
if (empty($matches)) {
form_error($element, t('%name should contain combination of 6 [0-9A-Fa-f] symbols.', array(
'%name' => $element['#title'],
)));
}
}