Could you support the Entity API and implement hook_entity_property_info())? Computed fields would be available in search_api & rules!
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | computed_field_1150184.patch | 2.15 KB | drewish |
| #8 | 1150184-support_entity_api-8.patch | 1.72 KB | tedfordgif |
Comments
Comment #1
Shadlington commentedSubscribing - this would be a very useful feature
Comment #2
lantha commentedI don't know if I am saying the same thing over here as I am noob to Drupal itself, but pretty much I would like to see the computed fields to be selectable in the rules data selectors, so that i can create conditions. Please can you add this useful feature?
Comment #3
Shadlington commentedYou're saying the same thing ;)
Comment #4
drewski803 commentedsubscribe
Comment #5
yareckon commentedNote that this would also help out other modules if computed field could be used for creating reprocessed fields for searching etc..
For instance I ran into an issue with search_api #1238702: Getting Year as a Facet from date and they don't have way to rewrite a field for indexing. If computed_field could support the entity api then it would become a much more general solution to "tokeny" stuff like this also. Here is the link drunken monkey gave me on how to integrate the entity api. http://drupal.org/node/1156554
I know that folks would probably have to specify a datatype at the end of their php computed field in order for you to have something to pass along, but it would still be worth it!
Comment #6
Bevan commentedsubscribe
Comment #7
tedfordgif commentedMaking an attempt on this today. Anyone else working on this?
Comment #8
tedfordgif commentedHere's a first pass at getting this working. It appears to be working with Search API, but it needs more testing and review by someone with more Entity API knowledge.
Comment #9
davidseth commentedHello @tedfordgif, I have been working on this as well. Great to see this patch. i will compare it to my work and see if I can help.
Cheers.
Comment #10
davidseth commentedTested patch at #8 and it works great. Thanks again @tedfordgif.
Comment #11
atlea commentedTested, works for me as well. :)
Comment #12
brycesenz commentedI had to flush my caches a few times, but the patch works perfectly (I have only tried it with Rules though). I would love to see this committed!
Comment #13
drewish commentedWell at the very least the commented out dpm()s should be removed before this is committed.
Comment #14
drewish commentedOkay I spent some time on this and I think the right way to do it is set 'property_callbacks' and then put a property_type in there and then let Entity API's own callback (entity_metadata_field_default_property_callback()) do the work.
Comment #15
tedfordgif commentedI like this approach. Thanks for doing the research to get it right.
Comment #16
Alex_cabello commentedI have the same problem. I can not used computed fields in rules, so I subscribe!
Comment #17
drewish commentedAlex_cabello, Feel free to test out the patch... but no need to post a message to subscribe to an issue any more, just use the Follow button at the top right of the page.
Comment #18
xlyz commentedworks for me
Comment #19
ptmkenny commentedI also had success making data comparisons after the patch. Thanks!
Comment #20
colanI think it needs a re-roll.
Comment #21
xlyz commentedI'm no expert of git am, but "patch < computed_field_1150184.patch" works fine.
maybe same problem reported here?
Comment #22
colanCommitted in 5503a0f. Thanks for the tip. "git am" needed a "--3way" switch.
Comment #24
jlstreckerIn case you find that your Computed field is still not showing up in the Data Selector list for Rules, despite having the up-to-date version of this module — Under Structure > Content Types > [your type] > Manage fields > [edit your field], see if the "Store value in the database" checkbox is checked. If not, it won't show up.