You are here

function taxonomy_manager_term_merge_form in Taxonomy Manager 7

Form for the Term merge module

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

File

./taxonomy_manager.admin.inc, line 585

Code

function taxonomy_manager_term_merge_form(&$form, $voc) {
  if (!module_exists('term_merge') || !user_access('merge terms')) {
    return;
  }
  $form['#attached']['js'][] = array(
    'data' => array(
      'hideForm' => array(
        array(
          'show_button' => 'edit-term-merge-show',
          'hide_button' => 'edit-term-merge-cancel',
          'div' => 'edit-term-merge',
        ),
      ),
    ),
    'type' => 'setting',
  );
  $description = t("This operation is based on the Term merge module. Selected terms get merged into the given one. Optionally the selected terms can be retained, otherwise they will be deleted.");
  $form['toolbar']['term_merge_show'] = array(
    //'#type' => 'button',
    '#attributes' => array(
      'class' => array(
        'taxonomy-manager-buttons merge',
      ),
    ),
    '#value' => t('Term merge'),
    '#theme' => 'no_submit_button',
  );
  $form['term_merge'] = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#attributes' => array(
      'style' => 'display:none;',
      'id' => 'edit-term-merge',
    ),
    '#title' => t('Merging of terms'),
    '#description' => $description,
  );
  $form['term_merge']['dest_term'] = array(
    '#type' => 'textfield',
    '#title' => t('Destination 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,
  );
  $form['term_merge']['options'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Options'),
    '#options' => array(
      'keep_merged' => t('Keep merged terms'),
    ),
  );
  $form['term_merge']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Merge'),
    '#attributes' => array(
      'class' => array(
        'taxonomy-manager-buttons',
        'merge',
      ),
    ),
    '#validate' => array(
      'taxonomy_manager_form_term_merge_validate',
    ),
    '#submit' => array(
      'taxonomy_manager_form_term_merge_submit',
    ),
  );
  $form['term_merge']['cancel'] = array(
    //'#type' => 'button',
    '#value' => t('Cancel'),
    '#attributes' => array(
      'class' => array(
        'taxonomy-manager-buttons',
        'cancel',
      ),
    ),
    '#theme' => 'no_submit_button',
  );
}