function imagecache_rgb_validate in ImageCache Actions 7
Same name and namespace in other branches
- 8 utility-color.inc \imagecache_rgb_validate()
Element validate handler to ensure a hexadecimal color value.
The core image_effect_color_validate() was not intelligent enough. Actually parse the value in order to see if it is parsable.
Parameters
array $element: param array $form_state Not used
1 string reference to 'imagecache_rgb_validate'
- imagecache_rgb_form in ./
utility-color.inc - Prepares a subform for displaying RGB fields.
File
- ./
utility-color.inc, line 88 - Utility functions for color widgets.
Code
function imagecache_rgb_validate($element) {
if ($element['#value'] != '') {
$rgba_value = imagecache_actions_hex2rgba($element['#value']);
if (!$rgba_value) {
// Returning NULL means a parse error.
form_error($element, t('!name must be a hexadecimal color value.', array(
'!name' => $element['#title'],
)));
}
}
}