function color_scheme_form_validate

Same name and namespace in other branches
  1. 9 core/modules/color/color.module \color_scheme_form_validate()
  2. 8.9.x core/modules/color/color.module \color_scheme_form_validate()

Form validation handler for color_scheme_form().

See also

color_scheme_form_submit()

1 string reference to 'color_scheme_form_validate'
color_form_system_theme_settings_alter in modules/color/color.module
Implements hook_form_FORM_ID_alter().

File

modules/color/color.module, line 349

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 (!color_valid_hexadecimal_string($color)) {
      form_set_error('palette][' . $key, t('%name must be a valid hexadecimal CSS color value.', array(
        '%name' => $form['color']['palette'][$key]['#title'],
      )));
    }
  }
}

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