function taxonomy_overview_vocabularies in Drupal 6
Same name and namespace in other branches
- 4 modules/taxonomy.module \taxonomy_overview_vocabularies()
- 5 modules/taxonomy/taxonomy.module \taxonomy_overview_vocabularies()
- 7 modules/taxonomy/taxonomy.admin.inc \taxonomy_overview_vocabularies()
Form builder to list and manage vocabularies.
See also
taxonomy_overview_vocabularies_submit()
theme_taxonomy_overview_vocabularies()
Related topics
1 string reference to 'taxonomy_overview_vocabularies'
- taxonomy_menu in modules/
taxonomy/ taxonomy.module - Implementation of hook_menu().
File
- modules/
taxonomy/ taxonomy.admin.inc, line 15 - Administrative page callbacks for the taxonomy module.
Code
function taxonomy_overview_vocabularies() {
$vocabularies = taxonomy_get_vocabularies();
$form = array(
'#tree' => TRUE,
);
foreach ($vocabularies as $vocabulary) {
$types = array();
foreach ($vocabulary->nodes as $type) {
$node_type = node_get_types('name', $type);
$types[] = $node_type ? check_plain($node_type) : check_plain($type);
}
$form[$vocabulary->vid]['#vocabulary'] = (array) $vocabulary;
$form[$vocabulary->vid]['name'] = array(
'#value' => check_plain($vocabulary->name),
);
$form[$vocabulary->vid]['types'] = array(
'#value' => implode(', ', $types),
);
$form[$vocabulary->vid]['weight'] = array(
'#type' => 'weight',
'#delta' => 10,
'#default_value' => $vocabulary->weight,
);
$form[$vocabulary->vid]['edit'] = array(
'#value' => l(t('edit vocabulary'), "admin/content/taxonomy/edit/vocabulary/{$vocabulary->vid}"),
);
$form[$vocabulary->vid]['list'] = array(
'#value' => l(t('list terms'), "admin/content/taxonomy/{$vocabulary->vid}"),
);
$form[$vocabulary->vid]['add'] = array(
'#value' => l(t('add terms'), "admin/content/taxonomy/{$vocabulary->vid}/add/term"),
);
}
// Only make this form include a submit button and weight if more than one
// vocabulary exists.
if (count($vocabularies) > 1) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
}
elseif (isset($vocabulary)) {
unset($form[$vocabulary->vid]['weight']);
}
return $form;
}