You are here

function tft_archive_file_form_submit in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 modules/tft_archive/includes/tft_archive.pages.inc \tft_archive_file_form_submit()

Submission callback

See also

tft_archive_term_form()

File

./tft.admin.inc, line 754

Code

function tft_archive_file_form_submit($form, $form_state) {
  $node = node_load($form_state['values']['nid']);

  // Get original folder.
  // Reconstruct list of terms by removing all folder terms.
  $taxonomy = array();
  foreach ($node->taxonomy as $term) {
    if ($term->vid != variable_get('tft_vocabulary_vid', 1)) {
      $taxonomy[] = $term->tid;
    }
    else {
      $tid = $term->tid;
    }
  }
  $og_nid = tft_get_og_nid($tid);
  $og_tid = tft_get_og_tid($og_nid);
  $archive_tid = tft_get_archive_tid($og_tid);
  $taxonomy[] = $archive_tid;
  $node->taxonomy = $taxonomy;
  node_save($node);
  tft_log_archive($node->nid, 'node', $tid, $og_nid);
  drupal_set_message(t("The <em>@title</em> file was archived.", array(
    '@title' => $node->title,
  )));
}