diff -u b/core/modules/color/color.module b/core/modules/color/color.module --- b/core/modules/color/color.module +++ b/core/modules/color/color.module @@ -63,7 +63,6 @@ '#theme' => 'color_scheme_form', ]; $form['color'] += color_scheme_form($form, $form_state, $theme); - $form['#validate'][] = 'color_scheme_form_validate'; // Ensure color submission happens first so we can unset extra values. array_unshift($form['#submit'], 'color_scheme_form_submit'); } @@ -180,7 +179,6 @@ * @param $theme * The machine name of the theme whose color settings are being configured. * - * @see color_scheme_form_validate() * @see color_scheme_form_submit() */ function color_scheme_form($complete_form, FormStateInterface $form_state, $theme) { @@ -338,23 +336,7 @@ } /** - * Form validation handler for color_scheme_form(). - * - * @see color_scheme_form_submit() - */ -function color_scheme_form_validate($form, FormStateInterface $form_state) { - // Only accept hexadecimal CSS color strings to avoid XSS upon use. - foreach ($form_state->getValue('palette') as $key => $color) { - if (!color_valid_hexadecimal_string($color)) { - $form_state->setErrorByName('palette][' . $key, t('You must enter a valid hexadecimal color value for %name.', ['%name' => $form['color']['palette'][$key]['#title']])); - } - } -} - -/** * Form submission handler for color_scheme_form(). - * - * @see color_scheme_form_validate() */ function color_scheme_form_submit($form, FormStateInterface $form_state) { only in patch2: unchanged: --- a/core/modules/color/tests/src/Functional/ColorTest.php +++ b/core/modules/color/tests/src/Functional/ColorTest.php @@ -81,7 +81,7 @@ protected function setUp(): void { '#00' => FALSE, '#0000' => FALSE, '#00000' => FALSE, - '123456' => FALSE, + '123456' => TRUE, '#00000g' => FALSE, ]; } @@ -174,7 +174,7 @@ public function testValidColor() { $this->assertText('The configuration options have been saved.'); } else { - $this->assertText('You must enter a valid hexadecimal color value for Main background.'); + $this->assertText('Main background must be a valid color.'); } } }