You are here

function taxonomy_manager_add_form in Taxonomy Manager 7

Same name and namespace in other branches
  1. 5 taxonomy_manager.module \taxonomy_manager_add_form()
  2. 6.2 taxonomy_manager.admin.inc \taxonomy_manager_add_form()
  3. 6 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 523

Code

function taxonomy_manager_add_form(&$form, $voc, $hide_form = TRUE) {
  $attributes = array();
  if ($hide_form) {
    $form['#attached']['js'][] = array(
      'data' => array(
        'hideForm' => array(
          array(
            'show_button' => 'edit-add-show',
            'hide_button' => 'edit-add-cancel',
            'div' => 'edit-add',
          ),
        ),
      ),
      'type' => 'setting',
    );
    $attributes = array(
      'style' => 'display:none;',
      'id' => 'edit-add',
    );
    $form['toolbar']['add_show'] = array(
      //'#type' => 'button',
      '#attributes' => array(
        'class' => 'taxonomy-manager-buttons add',
      ),
      '#value' => t('Add'),
      '#theme' => 'no_submit_button',
    );
  }
  $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,
  );
  $form['add']['mass_add'] = array(
    '#type' => 'textarea',
    '#title' => t('Terms'),
    '#description' => t("One term per line. Child terms can be prefixed with a\n        dash '-' (one dash per hierarchy level). Terms that should not become\n        child terms and start with a dash need to be wrapped in double quotes.\n        <br />Example:<br />\n        animals<br />\n        -canine<br />\n        --dog<br />\n        --wolf<br />\n        -feline<br />\n        --cat"),
    '#rows' => 10,
  );
  $form['add']['add'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => array(
        'taxonomy-manager-buttons',
        'add',
      ),
    ),
    '#value' => t('Add'),
    '#submit' => array(
      'taxonomy_manager_form_add_submit',
    ),
  );
  $form['add']['cancel'] = array(
    //'#type' => 'button',
    '#value' => t('Cancel'),
    '#theme' => 'no_submit_button',
    '#attributes' => array(
      'class' => array(
        'taxonomy-manager-buttons',
        'cancel',
      ),
    ),
  );
}