You are here

function tft_archive_file_form_submit in Taxonomy File Tree 7.2

Same name and namespace in other branches
  1. 7 tft.admin.inc \tft_archive_file_form_submit()

Submission callback for tft_archive_term_form().

File

modules/tft_archive/includes/tft_archive.pages.inc, line 155
Page and form callbacks.

Code

function tft_archive_file_form_submit($form, $form_state) {
  $node = $form['#node'];
  $taxonomy = array();
  foreach ($node->{"taxonomy_vocabulary_" . variable_get('tft_vocabulary_vid', 0)}[LANGUAGE_NONE] as $item) {
    $archive_tid = tft_archive_get_closest_parent_archive_tid($item['tid']);
    if ($archive_tid) {
      tft_archive_log($node->nid, 'node', $item['tid']);
      $taxonomy[] = array(
        'tid' => $archive_tid,
      );
    }
  }
  $node->{"taxonomy_vocabulary_" . variable_get('tft_vocabulary_vid', 0)}[LANGUAGE_NONE] = $taxonomy;
  node_save($node);
  drupal_set_message(t("The <em>@title</em> file was archived.", array(
    '@title' => $node->title,
  )));
}