You are here

function icon_bundle_configure_form_submit in Icon API 8

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

Submit callback for 'icon_bundle_configure_form'.

File

includes/admin.inc, line 307
admin.inc Provides administrative callbacks and tasks.

Code

function icon_bundle_configure_form_submit($form, &$form_state) {
  $destination = drupal_get_destination();
  $bundle = $form_state['bundle'];
  $button = $form_state['triggering_element']['#value'];
  if ($button === t('Reset bundle')) {
    $form_state['redirect'] = array(
      ICON_ADMIN_PATH . '/bundle/' . $bundle['name'] . '/reset',
      array(
        'query' => $destination,
      ),
    );
    return;
  }
  elseif ($button === t('Delete bundle')) {
    $form_state['redirect'] = array(
      ICON_ADMIN_PATH . '/bundle/' . $bundle['name'] . '/delete',
      array(
        'query' => $destination,
      ),
    );
    return;
  }
  $form_state['redirect'] = array(
    ICON_ADMIN_PATH,
  );
  $form_state
    ->cleanValues();
  $bundle = icon_array_merge_recursive($bundle, $form_state['values']);
  if (icon_bundle_save($bundle)) {
    drupal_set_message(t('Configuration for icon bundle %bundle has been saved.', array(
      '%bundle' => $bundle['title'],
    )));
  }
}