API page: http://api.drupal.org/api/drupal/modules%21taxonomy%21taxonomy.module/fu...

Enter a descriptive title (above) relating to taxonomy_vocabulary_get_names, then describe the problem you have found:

> An array of vocabulary ids, names, machine names, keyed by machine name.

It's an array, but each item of the array is an object.

    $vocabulary_data = taxonomy_vocabulary_get_names();
    debug($vocabulary_data);

// result:


array (
  'tags' => 
  stdClass::__set_state(array(
     'name' => 'Tags',
     'machine_name' => 'tags',
     'vid' => '1',
  )),
)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Issue tags: +Novice, +Needs backport to D7

Thanks for reporting this! Looks like a good novice project to fix the docs.

kim.pepper’s picture

Assigned: Unassigned » kim.pepper
Status: Active » Needs review
FileSize
638 bytes

I have updated the documentation to better reflect the actual returned structure.

joachim’s picture

Status: Needs review » Needs work
+++ b/core/modules/taxonomy/taxonomy.module
@@ -925,7 +925,7 @@ function taxonomy_vocabulary_static_reset($ids = NULL) {
+ *   An array of vocabulary objects keyed by machine name. Each vocabulary object contains name, machine name, and vid.

Sorry to nitpick... but elsewhere, a vocabulary object is a specific thing with a consistent structure. Here we have something different and specific to this function. So here we should say 'an array of data objects keyed by vocabulary machine name' or something similar.

1 days to next Drupal core point release.

kim.pepper’s picture

Status: Needs work » Needs review
FileSize
626 bytes

Updated docs as per #3

jhodgdon’s picture

Status: Needs review » Needs work

Hm.

There are a few things that need to be fixed with this patch:
- No lines can be longer than 80 characters, see
http://drupal.org/node/1354#general
- I don't think I like the wording. I have never seen the wording "data objects" in docs that I can recall -- I mean, all objects represent data, so it seems silly. My suggestion would be:
An associative array of objects with information about taxonomy vocabularies. Each object has properties:
- And then the actual property names would be listed below using list syntax
http://drupal.org/node/1354#lists
which would give the actual property name and a description of what it is.

kim.pepper’s picture

Hi Jen,

You certainly have a way with words!

Please find attached the re-worded patch, with line lengths fixed.

kim.pepper’s picture

Status: Needs work » Needs review
kim.pepper’s picture

Removed extra whitespace at the end of the first line.

joachim’s picture

Status: Needs review » Needs work

That's looking great! Except we've lost the information about the array being keyed by machine name. Nearly there :D

kim.pepper’s picture

Status: Needs work » Needs review
FileSize
773 bytes

Doh! Trying again.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me :)

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work

The list in this patch does not follow our list syntax guidelines:
http://drupal.org/node/1354#lists
(period at end, capital letter after :).

Also, "ID" means identifier, while "id" is a psychological term (ego, superego, id).

kim.pepper’s picture

Status: Needs work » Needs review
FileSize
776 bytes

OK. Hopefully this is it...

I'm also interested to know if there is an automated tool for checking comment syntax??

Kim

jhodgdon’s picture

Status: Needs review » Needs work

There is no automated tool for checking comment syntax, aside from the bare minimums covered by the Coder module, that I am aware of.

Anyway, this patch looks good, oh wait, "vocubulary" is not spelled correctly.

After we're done with this, should we file a separate issue to change the name of this function? With a name like "taxonomy_vocabulary_get_names()", you would think it would just return the names of the vocabs... :)

kim.pepper’s picture

Status: Needs work » Needs review
FileSize
776 bytes

Typo fixed.

jhodgdon’s picture

Status: Needs review » Fixed

Committed to 8.x, and 7.x thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.