Greetings,

At the moment vocabulary has no internal name and this is very inconvenient especially when we need to know which exactly vocabulary to take after calling taxonomy_get_vocabularies() function. Long time ago node type had only ID and human name. Today node type has both machine and human readable names.

My proposition is to add the same internal name for vocabularies and use it as a key. Upon calling
$vocabularies = taxonomy_get_vocabularies() we will be able to access needed vocabulary this way: $vocabularies['groups'] instead of $vocabularies[15] which is difficult to determine.

This is very useful when you manually created several vocabularies and develop a module specific to the certain project and you need to be able to access a certain vocabulary created for this project. We can't use vocabulary name because it can be changed for UI purposes, we also can't use VID because it MAY change when recreating database (dev, production, other servers).

Your thoughts?
Thanks.

Comments

Gábor Hojtsy’s picture

Version: 6.x-dev » 7.x-dev

I don't know when did you experience node types without names, but for the past four years through which I was part of the community, node types always had machine readable internal names.

Anyway, having names for vocabularies sounds like a sane idea to me. Unfortunately feature requests go to 7.x, so this is not considered for 6.x We are fixing bugs in 6.x now.

ardas’s picture

Yes, they had. I confused with human names.

pieter_duijves’s picture

+1

at this point we need to use either Drupal variables or vocabulary name text matching for referring to vocabularies from custom modules

$vid = variable_get('vocabulary_id_carbrands', 0);

or

$vid = '';
$vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vocabulary) {
  if(drupal_strtolower($vocabulary->name) == 'car brands') {
    $vid = $vocabulary->vid;
  }
}

which both are not too fool-proof :(

sun’s picture

Status: Active » Closed (duplicate)

Thanks for taking the time to report this issue.

However, marking as duplicate of #471018: Generic pattern/js for hiding machine readable names (applied to menu and content types).
You can follow up on that issue to track its status instead. If any information from this issue is missing in the other issue, please make sure you provide it over there.