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.

Comments

minoroffense’s picture

I 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.

minoroffense’s picture

Ok, 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 context
5) 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

fmizzell’s picture

minoroffense’s picture

Status: Active » Closed (duplicate)

Yes it is.