diff options
Diffstat (limited to 'modules/taxonomy.module')
-rw-r--r-- | modules/taxonomy.module | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module index 725bfe1f6..5e2f343a5 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -21,18 +21,26 @@ function taxonomy_perm() { return array("administer taxonomy"); } +/** + * Implementation of hook_link(). + * + * This hook is extended with $type = 'taxonomy terms' to allow themes to + * print lists of terms associated with a node. Themes can print taxonomy + * links with: + * + * if (module_exist('taxonomy')) { + * $this->links(taxonomy_link('taxonomy terms', $node)); + * } + */ function taxonomy_link($type, $node = NULL) { - if ($type == "system") { - if (user_access("administer taxonomy")) { - menu("admin/taxonomy", t("categories"), "taxonomy_admin", 3); - menu("admin/taxonomy/add/vocabulary", t("create new vocabulary"), "taxonomy_admin"); - menu("admin/taxonomy/help", t("help"), "taxonomy_admin", 9); - } - if (user_access("access content")) { - menu("taxonomy", t("taxonomy"), "taxonomy_page", 0, MENU_HIDE, MENU_LOCKED); - } + if ($type == 'system') { + menu('admin/taxonomy', t('categories'), user_access('administer taxonomy') ? 'taxonomy_admin' : MENU_DENIED, 3); + menu('admin/taxonomy/add/vocabulary', t('create new vocabulary'), user_access('administer taxonomy') ? 'taxonomy_admin' : MENU_DENIED); + menu('admin/taxonomy/help', t('help'), user_access('administer taxonomy') ? 'taxonomy_admin' : MENU_DENIED, 9); + + menu('taxonomy', t('taxonomy'), user_access('access content') ? 'taxonomy_page' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED); } - else if ($type == "taxonomy terms" && $node != NULL) { + else if ($type == 'taxonomy terms' && $node != NULL) { $links = array(); if ($node->taxonomy) { foreach ($node->taxonomy as $tid) { @@ -41,15 +49,6 @@ function taxonomy_link($type, $node = NULL) { } } else { - - /* - ** Themes can print taxonomy links with: - ** - ** if (module_exist("taxonomy")) { - ** $this->links(taxonomy_link("taxonomy terms", $node)); - ** } - */ - $links = array(); foreach (taxonomy_node_get_terms($node->nid) as $term) { $links[] = l($term->name, "taxonomy/page/or/$term->tid"); |