You are here

function taxonomy_menu_overview_terms_submit in Taxonomy menu 7.2

Additional submit handler for terms overview form.

See also

taxonomy_menu_form_taxonomy_overview_terms()

1 string reference to 'taxonomy_menu_overview_terms_submit'
taxonomy_menu_form_taxonomy_overview_terms in ./taxonomy_menu.admin.inc
Form constructor for the terms overview form. We provide an additional callback.

File

./taxonomy_menu.admin.inc, line 267
Administrative page callbacks for the Taxonomy menu module.

Code

function taxonomy_menu_overview_terms_submit(&$form, &$form_state) {

  // This form has the following flow of buttons:
  // 1. [Save] --> update taxonomy menu
  // 2. [Reset to alphabetical] --> do nothing, wait for confirmation page
  // 3. [Reset to alphabetical][Reset to alphabetical] --> update taxonomy menu
  // 4. [Reset to alphabetical][Cancel] --> do nothing
  $update = FALSE;
  if (isset($form_state['confirm_reset_alphabetical']) && $form_state['confirm_reset_alphabetical'] === TRUE) {
    if ($form_state['values']['reset_alphabetical'] === TRUE) {
      $update = TRUE;
    }
  }
  else {
    if ($form_state['clicked_button']['#value'] == t('Save')) {
      $update = TRUE;
    }
  }
  if ($update === TRUE) {
    $vid = isset($form['vid']['#value']) ? $form['vid']['#value'] : $form['#vocabulary']->vid;
    if ($vid) {
      $menu_name = taxonomy_menu_variable_get('vocab_menu', $vid, '0');
      $sync = taxonomy_menu_variable_get('sync', $vid, 0);
      if ($menu_name && $sync) {
        taxonomy_menu_menu_links_update($vid);
      }
    }
  }
}