You are here

function tft_add_term_form in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 includes/tft.pages.inc \tft_add_term_form()

Add a term form.

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

File

./tft.admin.inc, line 334

Code

function tft_add_term_form() {

  // Check that a vocabulary is set for Taxonomy File Tree
  tft_check_vocabulary_setting();
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t("Name"),
    '#required' => TRUE,
    '#weight' => -10,
  );
  $parent = !empty($_GET['parent']) ? (int) $_GET['parent'] : 0;
  if (!tft_term_access($parent)) {
    drupal_set_message(t("You do not have access to this folder. You cannot modify or delete it."), 'error');
    if ($destination = str_replace('%23', '#', $_GET['destination'])) {
      drupal_goto($destination);
    }
    else {
      drupal_goto();
    }
  }
  $form['parent'] = array(
    '#type' => 'hidden',
    '#value' => $parent,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t("Add"),
  );
  $form['cancel'] = array(
    '#value' => '<a href="/' . str_replace('%23', '#', $_GET['destination']) . '">' . t("cancel") . '</a>',
  );
  return $form;
}