We should provide a generic loader that can be used in menu item definitions and can load any type of entities.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 1126928-menu-loader.patch | 3.09 KB | bojanz |
| #1 | 1126928-generic-entity-menu-loader.patch | 1.14 KB | damien tournoud |
We should provide a generic loader that can be used in menu item definitions and can load any type of entities.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 1126928-menu-loader.patch | 3.09 KB | bojanz |
| #1 | 1126928-generic-entity-menu-loader.patch | 1.14 KB | damien tournoud |
Comments
Comment #1
damien tournoud commentedIt's an easy patch :)
Comment #2
bojanz commentedJust what the doctor ordered.
Comment #3
dave reidWouldn't you need to use
'load arguments' => array(1, 'myentity')?Comment #4
fagoad #3: I think the documented load arguments are fine.
@patch: Makes sense to me. However, we should also update the 'admin ui' provided with the entity API to make use of it. Thus, changing the default for 'menu wildcard' + updating the docs that ENTITY_TYPE_load() is not required any more should do it. (see entity.api.php).
I don't think we need this check, as reset() is fine with empty arrays and just returns FALSE.
Also, why do we need to catch exceptions here? Usually we don't do so?
Comment #5
bojanz commentedHere you go.
entity_object_load() could also be a wrapper around entity_load_single(), once #1027908: entity_load() should return entities keyed by ID, not name lands.
Comment #6
fagothanks, committed.
Comment #7
dave reidHrm, the load arguments still look wrong. According to the example, 'myentity' is going to be passed in as the entity_id and there is no value for the entity_type parameter.
Comment #8
damien tournoud commented'load arguments'is for additional arguments. The path part of the placeholder is always passed as the first argument.