function taxonomy_manager_form in Taxonomy Manager 5
Same name and namespace in other branches
- 6.2 taxonomy_manager.admin.inc \taxonomy_manager_form()
- 6 taxonomy_manager.admin.inc \taxonomy_manager_form()
- 7 taxonomy_manager.admin.inc \taxonomy_manager_form()
defines forms for taxonomy manager interface
Parameters
$vid vocabulary id:
$tid a term id, if not 0, displays term editing from for given tid on right side:
$search_string a string to filter root level terms:
4 string references to 'taxonomy_manager_form'
- taxonomy_manager_tree_build_child_form in ./
taxonomy_manager.module - callback for generating and rendering nested child forms (AHAH)
- taxonomy_manager_tree_build_siblings_form in ./
taxonomy_manager.module - callback for generating and rendering next siblings terms form (AHAH)
- taxonomy_manager_update_term_data_form in ./
taxonomy_manager.module - menu callback for displaying term data form
- taxonomy_manager_voc in ./
taxonomy_manager.module - returns either form for deletion confirm or the taxonomy manager form
File
- ./
taxonomy_manager.module, line 142 - Taxonomy Manager
Code
function taxonomy_manager_form($vid, $tid = 0, $filter = NULL) {
$module_path = drupal_get_path('module', 'taxonomy_manager') . '/';
drupal_add_css($module_path . 'css/taxonomy_manager.css');
drupal_add_js($module_path . 'js/hideForm.js');
drupal_add_js($module_path . 'js/updateWeight.js');
drupal_add_js($module_path . 'js/termData.js');
drupal_add_js('misc/textarea.js');
//because of term data form wich gets dynamically loaded
drupal_add_js(array(
'termData' => array(
'url' => url("admin/content/taxonomy_manager/termdata/edit/" . $vid),
'tid' => $tid,
'term_url' => url(taxonomy_manager_tree_link($vid) . '/' . $tid . '/true'),
),
), 'setting');
drupal_add_js(array(
'updateWeight' => array(
'up' => 'edit-weight-up',
'down' => 'edit-weight-down',
'url' => url('admin/content/taxonomy_manager/weight/' . $vid),
'disable_mouseover' => variable_get('taxonomy_manager_disable_mouseover_weights', 0),
),
), 'setting');
$form = array();
$voc = taxonomy_get_vocabulary($vid);
drupal_set_title(t("Taxonomy Manager - %voc_name", array(
"%voc_name" => $voc->name,
)));
if (!is_numeric($voc->vid)) {
$text = t('No vocabulary with this ID available!. ');
$text .= t('Check this !link_list for available vocabularies or !link_create a new one', array(
'!link_list' => l('list', 'admin/content/taxonomy_manager'),
'!link_create' => l('create', 'admin/content/taxonomy/add/vocabulary'),
));
$form['text'] = array(
'#value' => $text,
);
return $form;
}
$form['vid'] = array(
'#type' => 'value',
"#value" => $vid,
);
if (_taxonomy_manager_voc_is_empty($vid)) {
$text = t('No terms available');
$form['text'] = array(
'#value' => $text,
);
$form += taxonomy_manager_add_form($voc, false);
return $form;
}
$form['taxonomy']['#tree'] = TRUE;
$form['taxonomy']['manager'] = array(
'#type' => 'fieldset',
'#title' => check_plain($voc->name),
'#weight' => 10,
'#tree' => TRUE,
'#prefix' => '<div id="taxonomy-manager-tree-outer-div">',
'#suffix' => '</div>',
);
$form['taxonomy']['manager']['tree'] = array(
'#type' => 'taxonomy_manager_tree',
'#vid' => $vid,
'#pager' => TRUE,
'#search_string' => $tid ? NULL : $filter,
);
$search_description = t("You can search directly for exisiting terms. \n If your input doesn't match an existing term, it will be used for filtering root level terms (useful for non-hierarchical vocabularies).");
$form['search'] = array(
'#type' => 'fieldset',
'#attributes' => array(
'id' => 'taxonomy-manager-search',
),
'#title' => t('Search'),
'#description' => $search_description,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
);
$form['search']['field'] = array(
'#type' => 'textfield',
'#title' => t('Search String'),
'#autocomplete_path' => 'taxonomy/autocomplete/' . $voc->vid,
'#prefix' => '<div id="edit-find-field">',
'#suffix' => '</div>',
);
$form['search']['button'] = array(
'#type' => 'submit',
'#attributes' => array(
'class' => 'taxonomy-manager-buttons search',
),
'#value' => t('Search'),
'#suffix' => '<div class="clear"></div>',
);
$form['toolbar'] = array(
'#type' => 'fieldset',
'#title' => t('Toolbar'),
'#attributes' => array(
'id' => 'taxonomy-manager-toolbar',
),
);
$form['toolbar']['weight_up'] = array(
'#type' => 'button',
'#attributes' => array(
'class' => 'taxonomy-manager-buttons',
),
'#value' => t('Up'),
'#theme' => 'no_submit_button',
'#prefix' => '<div id="taxonomy-manager-toolbar-buttons">',
);
$form['toolbar']['weight-down'] = array(
'#type' => 'button',
'#attributes' => array(
'class' => 'taxonomy-manager-buttons',
),
'#value' => t('Down'),
'#theme' => 'no_submit_button',
);
$form['toolbar']['delete_confirm'] = array(
'#type' => 'button',
'#attributes' => array(
'class' => 'taxonomy-manager-buttons delete',
),
'#value' => t('Delete'),
'#theme' => 'no_submit_button',
);
$form['toolbar']['add_show'] = array(
'#type' => 'button',
'#attributes' => array(
'class' => 'taxonomy-manager-buttons add',
),
'#value' => t('Add'),
'#theme' => 'no_submit_button',
);
//moving is only possible in hierarchies...
if ($voc->hierarchy != 0) {
$form['toolbar']['move_show'] = array(
'#type' => 'button',
'#value' => t('Move'),
'#attributes' => array(
'class' => 'taxonomy-manager-buttons move',
),
'#theme' => 'no_submit_button',
);
}
$form['toolbar']['merge_show'] = array(
'#type' => 'button',
'#attributes' => array(
'class' => 'taxonomy-manager-buttons merge',
),
'#value' => t('Merge'),
'#theme' => 'no_submit_button',
);
$form['toolbar']['export_show'] = array(
'#type' => 'button',
'#attributes' => array(
'class' => 'taxonomy-manager-buttons export',
),
'#value' => t('CSV Export'),
'#theme' => 'no_submit_button',
'#suffix' => '</div>',
);
$form['toolbar']['wrapper'] = array(
'#type' => 'markup',
'#value' => '<div id="taxonomy-manager-toolbar-throbber"></div><div class="clear"></div>',
'#weight' => 20,
);
$form += taxonomy_manager_add_form($voc);
$form += taxonomy_manager_merge_form($voc);
$form += taxonomy_manager_move_form($voc);
$form += taxonomy_manager_confirm_delete($voc);
$form += taxonomy_manager_export_form($voc);
if ($tid) {
$form += taxonomy_manager_form_term_data($tid);
}
return $form;
}