You are here

function taxonomy_form_vocabulary_submit in Drupal 7

Same name and namespace in other branches
  1. 4 modules/taxonomy.module \taxonomy_form_vocabulary_submit()
  2. 5 modules/taxonomy/taxonomy.module \taxonomy_form_vocabulary_submit()
  3. 6 modules/taxonomy/taxonomy.admin.inc \taxonomy_form_vocabulary_submit()

Form submission handler for taxonomy_form_vocabulary().

See also

taxonomy_form_vocabulary()

taxonomy_form_vocabulary_validate()

File

modules/taxonomy/taxonomy.admin.inc, line 211
Administrative page callbacks for the taxonomy module.

Code

function taxonomy_form_vocabulary_submit($form, &$form_state) {
  if ($form_state['triggering_element']['#value'] == t('Delete')) {

    // Rebuild the form to confirm vocabulary deletion.
    $form_state['rebuild'] = TRUE;
    $form_state['confirm_delete'] = TRUE;
    return;
  }
  $vocabulary = $form_state['vocabulary'];
  entity_form_submit_build_entity('taxonomy_vocabulary', $vocabulary, $form, $form_state);
  switch (taxonomy_vocabulary_save($vocabulary)) {
    case SAVED_NEW:
      drupal_set_message(t('Created new vocabulary %name.', array(
        '%name' => $vocabulary->name,
      )));
      watchdog('taxonomy', 'Created new vocabulary %name.', array(
        '%name' => $vocabulary->name,
      ), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->machine_name . '/edit'));
      break;
    case SAVED_UPDATED:
      drupal_set_message(t('Updated vocabulary %name.', array(
        '%name' => $vocabulary->name,
      )));
      watchdog('taxonomy', 'Updated vocabulary %name.', array(
        '%name' => $vocabulary->name,
      ), WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/taxonomy/' . $vocabulary->machine_name . '/edit'));
      break;
  }
  $form_state['values']['vid'] = $vocabulary->vid;
  $form_state['vid'] = $vocabulary->vid;
  $form_state['redirect'] = 'admin/structure/taxonomy';
}