You are here

function tft_add_term_form in Taxonomy File Tree 7.2

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

Form: add a term.

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

File

includes/tft.pages.inc, line 102
Defines all page callbacks for TFT.

Code

function tft_add_term_form($form, $form_state) {
  $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"),
  );
  $parts = explode('#', str_replace('%23', '#', $_GET['destination']));
  $form['cancel'] = array(
    '#markup' => l(t("cancel"), $parts[0], array(
      'attributes' => array(
        'class' => array(
          'tft-cancel-button',
        ),
      ),
      'fragment' => isset($parts[1]) ? $parts[1] : '',
    )),
  );
  return $form;
}