You are here

function tft_archive_file_form 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()

Archive a term form

1 string reference to 'tft_archive_file_form'
tft_menu in ./tft.module
Implementation of hook_menu().

File

./tft.admin.inc, line 703

Code

function tft_archive_file_form($form, $form_state, $nid) {

  // Check that a vocabulary is set for Taxonomy File Tree
  tft_check_vocabulary_setting();
  $node = node_load($nid);
  if (!node_access('update', $node)) {
    drupal_set_message(t("You cannot edit this file."), 'error');
    if ($destination = str_replace('%23', '#', $_GET['destination'])) {
      drupal_goto($destination);
    }
    else {
      drupal_goto();
    }
  }
  if (empty($node->taxonomy)) {
    drupal_set_message(t("This file is not part of any tree. You cannot archive it."), 'error');
    if ($destination = str_replace('%23', '#', $_GET['destination'])) {
      drupal_goto($destination);
    }
    else {
      drupal_goto();
    }
  }
  drupal_set_title(t("Are you sure you want to archive file <em>@title</em> ?", array(
    '@title' => $node->title,
  )));
  $form['nid'] = array(
    '#type' => 'hidden',
    '#value' => $nid,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => "Archiver",
  );
  $form['cancel'] = array(
    '#value' => '<a href="/' . str_replace('%23', '#', $_GET['destination']) . '">' . t("cancel") . '</a>',
  );
  return $form;
}