function tft_archive_term_form in Taxonomy File Tree 7
Same name and namespace in other branches
- 7.2 modules/tft_archive/includes/tft_archive.pages.inc \tft_archive_term_form()
Archive a term form
1 string reference to 'tft_archive_term_form'
- tft_menu in ./
tft.module - Implementation of hook_menu().
File
- ./
tft.admin.inc, line 620
Code
function tft_archive_term_form($form, $form_state, $tid) {
// Check that a vocabulary is set for Taxonomy File Tree
tft_check_vocabulary_setting();
if (!tft_term_access($tid)) {
drupal_set_message(t("You do not have access to this folder. You cannot edit or delete it."), 'error');
if ($destination = str_replace('%23', '#', $_GET['destination'])) {
drupal_goto($destination);
}
else {
drupal_goto();
}
}
if (tft_is_archive_folder($tid)) {
drupal_set_message(t("Archive folders cannot be archived."), 'error');
if ($destination = str_replace('%23', '#', $_GET['destination'])) {
drupal_goto($destination);
}
else {
drupal_goto();
}
}
$name = db_query("SELECT name FROM {taxonomy_term_data} WHERE tid = :tid", array(
':tid' => $tid,
))
->fetchField();
// If no name was found
if (!$name) {
drupal_set_message(t("An error occured. The '@tid' folder could not be found. Please contac tthe site administrator.", array(
'@tid' => $tid,
)), 'error');
if ($destination = str_replace('%23', '#', $_GET['destination'])) {
drupal_goto($destination);
}
else {
drupal_goto();
}
}
drupal_set_title(t("Are you sure you want to delete folder <em>@term</em> ?", array(
'@term' => $name,
)));
$form['tid'] = array(
'#type' => 'hidden',
'#value' => $tid,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => "Archiver",
);
$form['cancel'] = array(
'#value' => '<a href="/' . str_replace('%23', '#', $_GET['destination']) . '">' . t("cancel") . '</a>',
);
return $form;
}