You are here

function taxonomy_manager_add_form in Taxonomy Manager 5

Same name and namespace in other branches
  1. 6.2 taxonomy_manager.admin.inc \taxonomy_manager_add_form()
  2. 6 taxonomy_manager.admin.inc \taxonomy_manager_add_form()
  3. 7 taxonomy_manager.admin.inc \taxonomy_manager_add_form()

form for adding terms

1 call to taxonomy_manager_add_form()
taxonomy_manager_form in ./taxonomy_manager.module
defines forms for taxonomy manager interface

File

./taxonomy_manager.module, line 387
Taxonomy Manager

Code

function taxonomy_manager_add_form($voc, $hide_form = TRUE) {
  if ($hide_form) {
    drupal_add_js(array(
      'hideForm' => array(
        'show_button' => 'edit-add-show',
        'hide_button' => 'edit-add-cancel',
        'div' => 'add-form',
      ),
    ), 'setting');
  }
  $form = array();
  $description = "";
  if ($voc->hierarchy >= 1) {
    $description = t("If you have selected one or more terms in the tree view, the new terms are automatically children of those.");
  }
  $form['add'] = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#title' => t('Add new terms'),
    '#prefix' => '<div id="add-form">',
    '#suffix' => '</div>',
    '#description' => $description,
  );
  for ($i = 0; $i < 6; $i++) {
    $form['add']['term'][$i] = array(
      '#type' => 'textfield',
    );
  }
  $form['add']['mass'] = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#title' => t('Mass term import (with textarea)'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['add']['mass']['mass_add'] = array(
    '#type' => 'textarea',
    '#title' => t('Terms'),
    '#description' => t('One term per line'),
    '#rows' => 10,
  );
  $form['add']['add'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons add',
    ),
    '#value' => t('Add'),
  );
  $form['add']['cancel'] = array(
    '#type' => 'button',
    '#value' => t('Cancel'),
    '#theme' => 'no_submit_button',
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons cancel',
    ),
  );
  return $form;
}