diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-03-25 11:53:25 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-03-25 11:53:25 +0000 |
commit | cca8e7e5acf71bc1462ef9197858a1629e96e6a3 (patch) | |
tree | 2e7b9e1cceb586d9d49c13ea89d211ab43a4894a /modules/taxonomy/taxonomy.module | |
parent | cfe7f8e69f9156284e1daf57921d89de256abda2 (diff) | |
download | brdo-cca8e7e5acf71bc1462ef9197858a1629e96e6a3.tar.gz brdo-cca8e7e5acf71bc1462ef9197858a1629e96e6a3.tar.bz2 |
- Patch #744258 by sun: admin/structure/taxonomy paths have to use machine_name(), not vid.
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 29 |
1 files changed, 22 insertions, 7 deletions
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 = '<p>' . t('Taxonomy is for categorizing content. Terms are grouped into vocabularies. For example, a vocabulary called "Fruit" would contain the terms "Apple" and "Banana".') . '</p>'; 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 '<p>' . 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)) . '</p>'; @@ -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), @@ -975,6 +975,21 @@ function taxonomy_vocabulary_load($vid) { } /** + * 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. * * @param $tid |