You are here

function ctools_stylizer_edit_style_form_default_submit in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/stylizer.inc \ctools_stylizer_edit_style_form_default_submit()

File

includes/stylizer.inc, line 1088
Create customized CSS and images from palettes created by user input.

Code

function ctools_stylizer_edit_style_form_default_submit($form, &$form_state) {

  // Store old settings for the purposes of cleaning up.
  $form_state['settings']['old_settings'] = $form_state['settings'];
  $form_state['settings']['palette'] = $form_state['values']['palette'];
  if (!empty($form_state['owner info']['owner form submit']) && function_exists($form_state['owner info']['owner form submit'])) {
    $form_state['owner info']['owner form submit']($form, $form_state);
  }
  if (!empty($form_state['plugin']['settings form submit']) && function_exists($form_state['plugin']['settings form submit'])) {
    $form_state['plugin']['settings form submit']($form, $form_state);
  }
  if ($form_state['clicked_button']['#value'] == t('Preview')) {
    $form_state['rerender'] = TRUE;

    // Update the cache with changes.
    if (!empty($form_state['name'])) {
      $cache = array(
        'settings' => $form_state['settings'],
      );
      if (!empty($form_state['owner info']['owner settings'])) {
        $cache['owner settings'] = $form_state['owner info']['owner settings'];
      }
      ctools_stylizer_set_settings_cache($form_state['name'], $cache);
    }
  }
}