You are here

function taxonomy_menu_term_set_form_submit in Taxonomy menu 6.3

Submit handler for taxonomy_term_set_form

File

./taxonomy_menu.admin.inc, line 483
admin section for taxonomy menu

Code

function taxonomy_menu_term_set_form_submit($form, &$form_state) {

  //Do not run the submit for the AHAH callback
  if ($form_state['clicked_button']['#value'] === t('Save')) {

    // Get the current Term Set ID from The hidden Value.
    $term_set['tsid'] = $form_state['values']['tsid'];

    // Update with the New Values.
    $term_set['name'] = $form_state['values']['title'];
    $term_set['vid'] = $form_state['values']['vid'];

    // If a new term set then save to get the term set id
    if (!$form_state['values']['tsid']) {

      // Save the Term Set
      taxonomy_menu_save_term_set($term_set);
    }

    // Build the term tree
    $term_set['items'] = taxonomy_menu_build_tree($form_state['values']['vid'], $form_state['values']['terms']['selected_terms'], $term_set['tsid']);

    // Save the Term Set
    taxonomy_menu_save_term_set($term_set);

    //save TERM_SET options
    _taxonomy_menu_save_options('TERM_SET', $form_state['values']['term_set_options'], $term_set['tsid']);

    // Set redirect
    $form_state['#redirect'] = 'admin/build/taxonomy_menu/termset';
  }
}