image_effect_color_validate
function image_effect_color_validate
image_effect_color_validate($element, &$form_state)
Element validate handler to ensure a hexadecimal color value.
File
- modules/image/image.admin.inc, line 496
- Administration pages for image settings.
Code
function image_effect_color_validate($element, &$form_state) { if ($element['#value'] != '') { $hex_value = preg_replace('/^#/', '', $element['#value']); if (!preg_match('/^#[0-9A-F]{3}([0-9A-F]{3})?$/', $element['#value'])) { form_error($element, t('!name must be a hexadecimal color value.', array('!name' => $element['#title']))); } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!image!image.admin.inc/function/image_effect_color_validate/7.x