You are here

function olivero_theme_settings_validate in Drupal 10

Validation handler for the Olivero system_theme_settings form.

1 string reference to 'olivero_theme_settings_validate'
olivero_form_system_theme_settings_alter in core/themes/olivero/theme-settings.php
Implements hook_form_FORM_ID_alter() for system_theme_settings.

File

core/themes/olivero/theme-settings.php, line 125
Functions to support Olivero theme settings.

Code

function olivero_theme_settings_validate($form, FormStateInterface $form_state) {
  if (!preg_match('/^#[a-fA-F0-9]{6}$/', $form_state
    ->getValue('base_primary_color'))) {
    $form_state
      ->setErrorByName('base_primary_color', t('Colors must be 7-character string specifying a color hexadecimal format.'));
  }
}