function 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

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';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.