function image_effect_color_validate

Element validate handler to ensure a hexadecimal color value.

1 string reference to 'image_effect_color_validate'
image_rotate_form in modules/image/image.admin.inc
Form structure for the image rotate form.

File

modules/image/image.admin.inc, line 509

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'],
            )));
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.