summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-26 16:59:17 +0000
committerGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-26 16:59:17 +0000
commit3c795c554f9ada0df9518b5bdad3de02e25b2a61 (patch)
treebe65e48360db42130c240da223ec9e97239f2741
parent646cd1a7167b81f3ef913f5159bad497b20bafec (diff)
downloadbrdo-3c795c554f9ada0df9518b5bdad3de02e25b2a61.tar.gz
brdo-3c795c554f9ada0df9518b5bdad3de02e25b2a61.tar.bz2
#28625, further form API conversion of taxonomy.module and small bugfix in forms API, patch by profix898 and chx
-rw-r--r--modules/taxonomy.module32
-rw-r--r--modules/taxonomy/taxonomy.module32
2 files changed, 56 insertions, 8 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 647ef3f56..b14ca95f7 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -121,21 +121,45 @@ function taxonomy_menu($may_cache) {
* List and manage vocabularies.
*/
function taxonomy_overview_vocabularies() {
- $header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '2'));
- $vocabularies = taxonomy_get_vocabularies();
+ $vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vocabulary) {
$types = array();
foreach ($vocabulary->nodes as $type) {
$node_type = node_get_name($type);
$types[] = $node_type ? $node_type : $type;
}
- $rows[] = array(check_plain($vocabulary->name), implode(', ', $types), l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), l(t('list terms'), "admin/taxonomy/$vocabulary->vid"));
+ $form[$vocabulary->vid]['name'] = array('#value' => check_plain($vocabulary->name));
+ $form[$vocabulary->vid]['type'] = array('#value' => implode(', ', $types));
+ $form[$vocabulary->vid]['edit'] = array('#value' => l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"));
+ $form[$vocabulary->vid]['list'] = array('#value' => l(t('list terms'), "admin/taxonomy/$vocabulary->vid"));
}
+
+ return drupal_get_form('taxonomy_overview_vocabularies', $form);
+}
+/**
+ * Theme overview vocabularies.
+ */
+function theme_taxonomy_overview_vocabularies($form) {
+ $rows = array();
+ foreach (element_children($form) as $key) {
+ if (isset($form[$key]['name'])) {
+ $row = array();
+ $row[] = form_render($form[$key]['name']);
+ $row[] = form_render($form[$key]['type']);
+ $row[] = form_render($form[$key]['edit']);
+ $row[] = form_render($form[$key]['list']);
+ $rows[] = $row;
+ }
+ }
if (!$rows) {
$rows[] = array(array('data' => t('No categories available.'), 'colspan' => '4', 'class' => 'message'));
}
- return theme('table', $header, $rows, array('id' => 'taxonomy'));
+ $header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '2'));
+
+ $output = theme('table', $header, $rows, array('id' => 'taxonomy'));
+ $output .= form_render($form);
+ return $output;
}
/**
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 647ef3f56..b14ca95f7 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -121,21 +121,45 @@ function taxonomy_menu($may_cache) {
* List and manage vocabularies.
*/
function taxonomy_overview_vocabularies() {
- $header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '2'));
- $vocabularies = taxonomy_get_vocabularies();
+ $vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vocabulary) {
$types = array();
foreach ($vocabulary->nodes as $type) {
$node_type = node_get_name($type);
$types[] = $node_type ? $node_type : $type;
}
- $rows[] = array(check_plain($vocabulary->name), implode(', ', $types), l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), l(t('list terms'), "admin/taxonomy/$vocabulary->vid"));
+ $form[$vocabulary->vid]['name'] = array('#value' => check_plain($vocabulary->name));
+ $form[$vocabulary->vid]['type'] = array('#value' => implode(', ', $types));
+ $form[$vocabulary->vid]['edit'] = array('#value' => l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"));
+ $form[$vocabulary->vid]['list'] = array('#value' => l(t('list terms'), "admin/taxonomy/$vocabulary->vid"));
}
+
+ return drupal_get_form('taxonomy_overview_vocabularies', $form);
+}
+/**
+ * Theme overview vocabularies.
+ */
+function theme_taxonomy_overview_vocabularies($form) {
+ $rows = array();
+ foreach (element_children($form) as $key) {
+ if (isset($form[$key]['name'])) {
+ $row = array();
+ $row[] = form_render($form[$key]['name']);
+ $row[] = form_render($form[$key]['type']);
+ $row[] = form_render($form[$key]['edit']);
+ $row[] = form_render($form[$key]['list']);
+ $rows[] = $row;
+ }
+ }
if (!$rows) {
$rows[] = array(array('data' => t('No categories available.'), 'colspan' => '4', 'class' => 'message'));
}
- return theme('table', $header, $rows, array('id' => 'taxonomy'));
+ $header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '2'));
+
+ $output = theme('table', $header, $rows, array('id' => 'taxonomy'));
+ $output .= form_render($form);
+ return $output;
}
/**