When looking at the menu items generated by instances of ECK entities, the router item returned from menu_get_item() is missing the load function used to auto-load the entity into the menu context.
If you look at another entity defined using Entity API, for example Profile2, you'll see the "load_functions" array is populated. This leads me to believe these aren't being defined properly by ECK when creating entities.
This may also explain why the CTools contexts for Page Manager don't work properly (see #1493192: Does not work with urls generated by ECK)
See the screenshot attached.
What we need to do is ensure the menu items are defined with proper load function array lists so that CTools can do it's thing.
| Comment | File | Size | Author |
|---|---|---|---|
| Entity defined by Profile2 | 38.55 KB | minoroffense | |
| Entity defined by ECK | 58.17 KB | minoroffense |
Comments
Comment #1
minoroffense commentedI think what's missing is an explicit name to each argument and an appropriate "{argument_name}_load" function to match (similar to %node and node_load)
I'll give this a try and see what happens.
Comment #2
minoroffense commentedSee http://api.drupal.org/api/drupal/modules%21system%21system.api.php/funct...
Comment #3
minoroffense commentedOk, so here's my plan:
1) Add an entry for "load arguments" in the menu entries for entities created by ECK
2) Rename the '%' placeholder to '%eck_entity' in the menu definition
3) Create
function eck_entity_load();which gets called when loading menu items with the placeholder '%eck_entity'4) Pass through the information to
entity_load()so the entity object is loaded into the menu context5) Hope that this makes CTools happy.
The reason for all this is to allow the proper entity to be loaded when the meny replaces the placeholder. Since we need both the entity type and the entity id, the "load arguments" will ensure that we get the entity type from the url as well as the entity id from the placeholder.
Have a look at the load arguments section in the hook_menu docs in comment #2
Comment #4
fmizzell commentedcan we mark this as duplicate of #1373466: Flexibility to change url paths (page manager integration)?
Comment #5
minoroffense commentedYes it is.