I believe that the following is incorrect.

bundle keys: An array describing how the Field API can extract the information it needs from the bundle objects for this type (e.g $vocabulary objects for terms; not applicable for nodes). This entry can be omitted if this type's bundles do not exist as standalone objects.

node_entity_info defines ['entity keys']['bundle'], ['bundle keys'] and ['bundles'] for nodes. If that doesn't mean 'bundle keys' is applicable, then we need to at least improve the language there.
http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...

CommentFileSizeAuthor
#4 1014762-4.patch2.49 KBjhodgdon
#2 1014762.patch1.41 KBjhodgdon

Comments

jhodgdon’s picture

Thanks for filing this issue, after we discussed this in IRC. Needs a bit more investigation... The part in question is where it says "not applicable for nodes", which appears to be wrong.

jhodgdon’s picture

Status: Active » Needs review
StatusFileSize
new1.41 KB

Actually, only node and taxonomy entities in Core currently define 'bundle keys'.

I investigated, and I'm pretty sure that this component of entity info is only used in field_extract_bundle():
http://api.drupal.org/api/drupal/modules--field--field.module/function/f...

In Core, this function is called by the Field UI module in menu callback functions (page callbacks, load callback, and access callback). In all of these cases, the input argument $bundle to the function is a string, so it is never going to try to use 'bundle keys' at all (it will just return $bundle).

So my guess is that this doesn't really work.

That aside, since Node and Taxonomy are the two cases in Core that define this, definitely the part of the doc that says it doesn't apply to Node should be removed. Here's a patch.

yched’s picture

Did some history digging :
The "not applicable for nodes' part was added in #488542: Tie Field UI pages to any fieldable entity in July, 2009.
Later on, #597508: Use path argument loader for node type paths (Oct, 2009) made it moot.

The patch is correct. If we want to be exhaustive, the full explanation would be something like :

This entry is required if the 'path' provided in the 'bundles' section identifies the bundle using a named menu placeholder whose loader callback returns a structured object (e.g. $vocabulary for taxonomy terms, or $node_type for nodes).
This entry can notably be omitted if this type's bundles do not exist as stand-alone objects.

There might be a better wording :-/

jhodgdon’s picture

StatusFileSize
new2.49 KB

Ah, thanks! That makes sense to me, given my own investigations.

Here's a new patch, incorporating #3. I also made a small change in the referenced bundles/admin/path section, since it was referring to an element there that had apparently been removed.

yched’s picture

Status: Needs review » Reviewed & tested by the community

Works for me.

Thanks !

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

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