You are here

function sweaver_plugin_palettes::sweaver_form_submit in Sweaver 7

Same name and namespace in other branches
  1. 6 plugins/sweaver_plugin_palettes/sweaver_plugin_palettes.inc \sweaver_plugin_palettes::sweaver_form_submit()

Frontend form submit handler.

Overrides sweaver_plugin::sweaver_form_submit

File

plugins/sweaver_plugin_palettes/sweaver_plugin_palettes.inc, line 120
Palettes plugin.

Class

sweaver_plugin_palettes
@file Palettes plugin.

Code

function sweaver_form_submit($form, &$form_state) {
  $clicked_button = $form_state['clicked_button']['#value'];
  if (($clicked_button == t('Save and continue') || $clicked_button == t('Save and publish') || $clicked_button == t('Publish style')) && isset($form_state['style_id']) && isset($form_state['values']['sweaver_plugin_palette'])) {
    db_query("UPDATE {sweaver_style_draft} set palette = :palette WHERE style_id = :style_id", array(
      ':palette' => $form_state['values']['sweaver_plugin_palette'],
      ':style_id' => $form_state['style_id'],
    ));
    if ($form_state['publish']) {
      db_query("UPDATE {sweaver_style} set palette = :palette WHERE style_id = :style_id", array(
        ':palette' => $form_state['values']['sweaver_plugin_palette'],
        ':style_id' => $form_state['style_id'],
      ));
    }
  }
}