Seems I haven't created an issue for this, yet. I need an issue to point people to who complain to me about this, though.
The problem is the following: Say, I want all properties that are theoretically available for entities of a certain type (without having an actual entity, yet). When creating a wrapper, I can specify a 'property info alter' callback and use entity_get_all_property_info() to add all fields to the wrapper, including ones set only for some bundles.
However, when the entity contains a reference to another entity, there is at the moment no (not unnecessarily complicated) way to also get all fields of that referenced entity, including ones set on bundles.
Some way to accomplish this would be great.
It could either be another property info alter callback, which also gets called for nested entities, or just a single flag that says "get me all fields for all entities", or something else entirely.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 1214974--propagate-property-defaults.patch | 814 bytes | drunken monkey |
Comments
Comment #1
imiksuSubscribe :)
Comment #2
zambrey commentedSubscribe
Comment #3
fagoThere is not only
property info alter, but there is also aproperty defaultskey. Thus, you can use the property defaults key to set a property info alter callback by default for all derived wrappers, i.e. wrappers of all properties and so of referenced entities too.Comment #4
drunken monkeyAh, really, that's how it works? That's of course great, will try that.
Does this also work for wrappers derived from the derived wrappers (and so forth)?
Comment #5
fago>Does this also work for wrappers derived from the derived wrappers (and so forth)?
Good question - I think you'll have to care manually to pass the property defaults down. It would make sense to do that by default I guess, so I'd be happy to accept a little patch that passed the property defaults through.
Comment #6
zambrey commentedYou guys rock! I don't know what you are saying but keep up great work :)
Maybe one day I will have more time to learn all this things and will be able to help more.
Comment #7
drunken monkeyOK, giving it a shot with the attached patch.
Comment #8
zambrey commentedThanks for the patch.
I would like test this but first I need to understand what's going on here.
I came from #1214862: Custom fields not available on referred contents as I would like to use fields defined in Commerce Product in SearchAPI.
The OP in that issue described the situation clearly.
I applied this patch but nothing changes.
Do we need separate fix in SearchAPI or this issue should fix everything?
Comment #9
fagoPatch looks good. If it helps you to fix the problem I'm happy to commit it. Please report when there is a working solution.
Comment #10
drunken monkeyThis patch is only a prerequisite for fixing this in the Search API. I'll make a patch for the Search API soon, then you can test this.
Comment #11
zambrey commentedOkay, thanks for clarification and sorry for the noise.
Comment #12
drunken monkeyNot at all, I'm happy to clarify. Thanks for helping with the review!
@ Wolfgang: Just committed the Search API patch, seems to work great with this patch. So if you have no objections, it's ready to be committed.
Comment #13
imiksuThanks for the patch, working great together with patch committed in Search API issue!
Comment #14
fagoThanks, committed!