1 color.module color_scheme_form_submit($form, &$form_state)

Form submission handler for color_scheme_form().

See also

color_scheme_form_validate()

File

core/modules/color/color.module, line 503
Allows users to change the color scheme of themes.

Code

function color_scheme_form_submit($form, &$form_state) {
  // Get theme coloring info.
  if (!isset($form_state['values']['info'])) {
    return;
  }
  $theme = $form_state['values']['theme'];
  $info = $form_state['values']['info'];

  // Remove color info so it doesn't get saved in config.
  unset($form_state['values']['info']);

  // Resolve palette.
  $palette = $form_state['values']['palette'];
  if ($form_state['values']['scheme'] != '') {
    foreach ($palette as $key => $color) {
      if (isset($info['schemes'][$form_state['values']['scheme']]['colors'][$key])) {
        $palette[$key] = $info['schemes'][$form_state['values']['scheme']]['colors'][$key];
      }
    }
    $palette += $info['schemes']['default']['colors'];
  }

  // Remove color field elements.
  unset($form_state['values']['scheme']);
  unset($form_state['values']['palette']);
  unset($_SESSION['color']);

  // Save all the values into form state for saving to config.
  $form_state['values']['color'] = color_save_configuration($theme, $info, $palette);
}