You are here

function taxonomy_manager_move_form in Taxonomy Manager 5

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

form for moving terms in hierarchies

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

File

./taxonomy_manager.module, line 521
Taxonomy Manager

Code

function taxonomy_manager_move_form($voc) {
  drupal_add_js(array(
    'hideForm' => array(
      'show_button' => 'edit-move-show',
      'hide_button' => 'edit-move-cancel',
      'div' => 'move-form',
    ),
  ), 'setting');
  $form = array();
  $description = t("You can change the parent of one or more selected terms. \n      If you leave the autocomplete field empty, the term will be a root term.");
  $form['move'] = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#title' => t('Moving of terms'),
    '#description' => $description,
    '#prefix' => '<div id="move-form">',
    '#suffix' => '</div>',
  );
  if ($voc->hierarchy == 2) {
    $auto_description .= t("Separate parent terms with a comma. ");
  }
  $form['move']['parents'] = array(
    '#type' => 'textfield',
    '#title' => t('Parent term(s)'),
    '#description' => $auto_description,
    '#required' => FALSE,
    '#autocomplete_path' => 'taxonomy/autocomplete/' . $voc->vid,
  );
  $options = array();
  if ($voc->hierarchy == 2) {
    $options['keep_old_parents'] = t('Keep old parents and add new ones (multi-parent). Otherwise old parents get replaced.');
  }
  if (count($options) > 0) {
    $form['move']['options'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Options'),
      '#options' => $options,
    );
  }
  $form['move']['submit'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons move',
    ),
    '#value' => t('Move'),
  );
  $form['move']['cancel'] = array(
    '#type' => 'button',
    '#value' => t('Cancel'),
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons cancel',
    ),
    '#theme' => 'no_submit_button',
  );
  return $form;
}