You are here

function taxonomy_manager_merge_form in Taxonomy Manager 6.2

Same name and namespace in other branches
  1. 5 taxonomy_manager.module \taxonomy_manager_merge_form()
  2. 6 taxonomy_manager.admin.inc \taxonomy_manager_merge_form()

form for merging terms

1 call to taxonomy_manager_merge_form()
taxonomy_manager_form in ./taxonomy_manager.admin.inc
defines forms for taxonomy manager interface

File

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

Code

function taxonomy_manager_merge_form($voc) {
  drupal_add_js(array(
    'hideForm' => array(
      'show_button' => 'edit-merge-show',
      'hide_button' => 'edit-merge-cancel',
      'div' => 'merge-form',
    ),
  ), 'setting');
  $form = array();
  $description .= t("The selected terms get merged into one term.\n    This resulting merged term can either be an exisiting term or a completely new term.\n    The selected terms will automatically get synomyms of the merged term and will be deleted afterwards.");
  $form['merge'] = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#attributes' => array(
      'id' => 'merge-form',
      'style' => 'display:none;',
    ),
    '#title' => t('Merging of terms'),
    '#description' => $description,
  );
  $form['merge']['main_term'] = array(
    '#type' => 'textfield',
    '#title' => t('Resulting merged term'),
    '#description' => t("Enter a unique term name or a term id with 'term-id:[tid]'"),
    '#required' => FALSE,
    '#autocomplete_path' => 'taxonomy_manager/autocomplete/' . $voc->vid,
  );
  $options = array();
  $options['collect_parents'] = t('Collect all parents of selected terms an add it to the merged term');
  $options['collect_children'] = t('Collect all children of selected terms an add it to the merged term');
  $options['collect_relations'] = t('Collect all relations of selected terms an add it to the merged term');
  if (count($options) > 0) {
    $form['merge']['options'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Options'),
      '#options' => $options,
    );
  }
  $form['merge']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Merge'),
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons merge',
    ),
    '#validate' => array(
      'taxonomy_manager_form_merge_validate',
    ),
    '#submit' => array(
      'taxonomy_manager_form_merge_submit',
    ),
  );
  $form['merge']['cancel'] = array(
    '#type' => 'button',
    '#value' => t('Cancel'),
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons cancel',
    ),
    '#theme' => 'no_submit_button',
  );
  return $form;
}