From cca8e7e5acf71bc1462ef9197858a1629e96e6a3 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 25 Mar 2010 11:53:25 +0000 Subject: - Patch #744258 by sun: admin/structure/taxonomy paths have to use machine_name(), not vid. --- modules/taxonomy/taxonomy.module | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'modules/taxonomy/taxonomy.module') diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 944efe348..df5ce1bb5 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -42,7 +42,7 @@ function taxonomy_help($path, $arg) { $output = '

' . t('Taxonomy is for categorizing content. Terms are grouped into vocabularies. For example, a vocabulary called "Fruit" would contain the terms "Apple" and "Banana".') . '

'; return $output; case 'admin/structure/taxonomy/%': - $vocabulary = taxonomy_vocabulary_load($arg[3]); + $vocabulary = taxonomy_vocabulary_machine_name_load($arg[3]); switch ($vocabulary->hierarchy) { case 0: return '

' . t('You can reorganize the terms in %capital_name using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name)) . '

'; @@ -109,8 +109,8 @@ function taxonomy_entity_info() { $return['taxonomy_term']['bundles'][$machine_name] = array( 'label' => $vocabulary->name, 'admin' => array( - 'path' => 'admin/structure/taxonomy/%taxonomy_vocabulary', - 'real path' => 'admin/structure/taxonomy/' . $vocabulary->vid, + 'path' => 'admin/structure/taxonomy/%taxonomy_vocabulary_machine_name', + 'real path' => 'admin/structure/taxonomy/' . $machine_name, 'bundle argument' => 3, 'access arguments' => array('administer taxonomy'), ), @@ -302,7 +302,7 @@ function taxonomy_menu() { 'file' => 'taxonomy.pages.inc', ); - $items['admin/structure/taxonomy/%taxonomy_vocabulary'] = array( + $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name'] = array( 'title callback' => 'taxonomy_admin_vocabulary_title_callback', 'title arguments' => array(3), 'page callback' => 'drupal_get_form', @@ -310,12 +310,12 @@ function taxonomy_menu() { 'access arguments' => array('administer taxonomy'), 'file' => 'taxonomy.admin.inc', ); - $items['admin/structure/taxonomy/%taxonomy_vocabulary/list'] = array( + $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -20, ); - $items['admin/structure/taxonomy/%taxonomy_vocabulary/edit'] = array( + $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/edit'] = array( 'title' => 'Edit', 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_form_vocabulary', 3), @@ -325,7 +325,7 @@ function taxonomy_menu() { 'file' => 'taxonomy.admin.inc', ); - $items['admin/structure/taxonomy/%taxonomy_vocabulary/add'] = array( + $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/add'] = array( 'title' => 'Add term', 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_form_term', array(), 3), @@ -974,6 +974,21 @@ function taxonomy_vocabulary_load($vid) { return reset($vocabularies); } +/** + * Return the vocabulary object matching a vocabulary machine name. + * + * @param $name + * The vocabulary's machine name. + * + * @return + * The vocabulary object with all of its metadata, if exists, FALSE otherwise. + * Results are statically cached. + */ +function taxonomy_vocabulary_machine_name_load($name) { + $vocabularies = taxonomy_vocabulary_load_multiple(NULL, array('machine_name' => $name)); + return reset($vocabularies); +} + /** * Return the term object matching a term ID. * -- cgit v1.2.3