You are here

function better_messages_admin_skin_form_submit in Better Messages 7.2

Form submission handler for the main Better Messages settings administration form.

See also

better_messages_admin_form()

File

./better_messages.admin.inc, line 414

Code

function better_messages_admin_skin_form_submit($form, &$form_state) {

  // If form was submitted through new addition or clone.
  if ($form_state['build_info']['args'][0] == 'add' || $form_state['build_info']['args'][0] == 'clone') {
  }

  // If form was submitted editting an existing skin.
  if ($form_state['build_info']['args'][0] == 'edit') {
  }
  $settings = array(
    'placement' => array(
      'pos_x' => $form_state['values']['pos_x'],
      'pos_y' => $form_state['values']['pos_y'],
      'space_x' => trim($form_state['values']['space_x']),
      'space_y' => trim($form_state['values']['space_y']),
      'width' => trim($form_state['values']['width']),
      'fixed' => $form_state['values']['fixed'],
    ),
    'animation' => array(
      'popin' => array(
        'effect' => $form_state['values']['popin_effect'],
        'easing' => trim($form_state['values']['popin_easing']),
        'duration' => trim($form_state['values']['popin_duration']),
        'opendelay' => trim($form_state['values']['open_delay']),
      ),
      'popout' => array(
        'effect' => $form_state['values']['popout_effect'],
        'easing' => trim($form_state['values']['popout_easing']),
        'duration' => trim($form_state['values']['popout_duration']),
        'autoclose' => array(
          'seconds' => trim($form_state['values']['autoclose_seconds']),
          'disable_autoclose_error' => $form_state['values']['disable_autoclose_error'],
          'disable_autoclose_hover' => $form_state['values']['disable_autoclose_hover'],
          'show_countdown' => $form_state['values']['show_countdown'],
        ),
      ),
    ),
    'jquery_ui' => array(
      'draggable' => $form_state['values']['draggable'],
    ),
    'admin' => array(
      'visibility' => array(
        'visibility' => $form_state['values']['visibility'],
        'pages' => trim($form_state['values']['pages']),
      ),
      'title' => $form_state['values']['name'],
      'css' => $form_state['values']['css_path'],
      'storage' => 'custom',
    ),
  );
  $skin = array(
    'name' => $form_state['values']['machine_name'],
    'data' => serialize($settings),
  );
  drupal_write_record('better_messages', $skin);
  drupal_set_message(t('The configuration options for the skin %skin have been saved.', array(
    '%skin' => $form_state['values']['name'],
  )));
  $form_state['redirect'] = array(
    'admin/config/user-interface/better-messages',
  );
}