function color_scheme_form_validate

7.x color.module color_scheme_form_validate($form, &$form_state)
6.x color.module color_scheme_form_validate($form, &$form_state)

Validation handler for color change form.

1 string reference to 'color_scheme_form_validate'
color_form_alter in drupal-6.x/modules/color/color.module
Implementation of hook_form_alter().

File

drupal-6.x/modules/color/color.module, line 242

Code

function color_scheme_form_validate($form, &$form_state) {
  // Only accept hexadecimal CSS color strings to avoid XSS upon use.
  foreach ($form_state['values']['palette'] as $key => $color) {
    if (!preg_match('/^#([a-f0-9]{3}){1,2}$/iD', $color)) {
      form_set_error('palette][' . $key, t('%name must be a valid hexadecimal CSS color value.', array('%name' => $form['color']['palette'][$key]['#title'])));
    }
  }
}