You are here

function royalslider_form_optionset_add_submit in RoyalSlider Integration 7

Submit handler for adding a new option set.

File

./royalslider.admin.inc, line 10
Admin forms for RoyalSlider.

Code

function royalslider_form_optionset_add_submit($form, &$form_state) {
  $optionset = royalslider_optionset_create(array(
    'name' => $form_state['values']['name'],
    'title' => $form_state['values']['title'],
  ));
  $saved = royalslider_optionset_save($optionset, TRUE);
  if ($saved) {
    drupal_set_message(t('Option set %name was created.', array(
      '%name' => $optionset->name,
    )));
    $form_state['redirect'] = 'admin/config/media/royalslider/edit/' . $optionset->name;
  }
  else {
    drupal_set_message(t('Failed to create option set. Please verify your settings.'), 'error');
  }
}