You are here

function taxonomy_revision_taxonomy_overview_terms_submit in Taxonomy revision 7

Custom submit handler for the taxonomy terms overview form.

1 string reference to 'taxonomy_revision_taxonomy_overview_terms_submit'
taxonomy_revision_form_taxonomy_overview_terms_alter in ./taxonomy_revision.module
Implements hook_form_FORM_ID_alter().

File

./taxonomy_revision.module, line 479
This is the main module file for the Taxonomy revision module.

Code

function taxonomy_revision_taxonomy_overview_terms_submit($form, &$form_state) {

  // The standard taxonomy_overview_terms_submit() submit handler writes the
  // modified term weights directly to the {taxonomy_term_data} table. Sync
  // them here so they apply to all revisions also.
  $term_weights = db_query('SELECT tid, weight FROM {taxonomy_term_data} WHERE vid = :vid', array(
    ':vid' => $form['#vocabulary']->vid,
  ))
    ->fetchAllKeyed();
  foreach ($term_weights as $tid => $weight) {
    db_update('taxonomy_term_data_revision')
      ->fields(array(
      'weight' => $weight,
    ))
      ->condition('tid', $tid)
      ->execute();
  }
}