taxonomy_form_vocabulary_submit

5 taxonomy.module taxonomy_form_vocabulary_submit($form_id, $form_values)
6 taxonomy.admin.inc taxonomy_form_vocabulary_submit($form, &$form_state)
7 taxonomy.admin.inc taxonomy_form_vocabulary_submit($form, &$form_state)
8 taxonomy.admin.inc taxonomy_form_vocabulary_submit($form, &$form_state)

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';
}
Login or register to post comments