You are here

function taxonomy_manager_add_form in Taxonomy Manager 6.2

Same name and namespace in other branches
  1. 5 taxonomy_manager.module \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.admin.inc
defines forms for taxonomy manager interface

File

./taxonomy_manager.admin.inc, line 476
Taxonomy Manager Admin

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');
    $attributes = array(
      'id' => 'add-form',
      'style' => 'display:none;',
    );
  }
  else {
    $attributes = array(
      'id' => 'add-form',
    );
  }
  $form = array();
  $description = "";
  $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,
    '#attributes' => $attributes,
    '#title' => t('Add new terms'),
    '#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'),
    '#validate' => array(
      'taxonomy_manager_form_add_validate',
    ),
    '#submit' => array(
      'taxonomy_manager_form_add_submit',
    ),
  );
  $form['add']['cancel'] = array(
    '#type' => 'button',
    '#value' => t('Cancel'),
    '#theme' => 'no_submit_button',
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons cancel',
    ),
  );
  return $form;
}