You are here

function tft_archive_term_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_term_form_submit()

Submission callback

See also

tft_archive_term_form()

File

./tft.admin.inc, line 683

Code

function tft_archive_term_form_submit($form, $form_state) {
  $name = db_query("SELECT name FROM {taxonomy_term_data} WHERE tid = :tid", array(
    ':tid' => $form_state['values']['tid'],
  ))
    ->fetchField();
  $nid = tft_get_og_nid($form_state['values']['tid']);
  $og_tid = tft_get_og_tid($nid);
  $archive_tid = tft_get_archive_tid($og_tid);
  $parent_tid = db_query("SELECT parent FROM {taxonomy_term_hierarchy} WHERE tid = :tid", array(
    ':tid' => $form_state['values']['tid'],
  ))
    ->fetchField();
  db_update('taxonomy_term_hierarchy')
    ->fields(array(
    'parent' => $archive_tid,
  ))
    ->condition('tid', $form_state['values']['tid'])
    ->execute();
  tft_log_archive($form_state['values']['tid'], 'term', $parent_tid, $nid);
  drupal_set_message(t("The <em>@term</em> folder was archived.", array(
    '@term' => $name,
  )));
}