Could you support the Entity API and implement hook_entity_property_info())? Computed fields would be available in search_api & rules!

Comments

Shadlington’s picture

Subscribing - this would be a very useful feature

lantha’s picture

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

Shadlington’s picture

You're saying the same thing ;)

drewski803’s picture

subscribe

yareckon’s picture

Note 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!

Bevan’s picture

subscribe

tedfordgif’s picture

Making an attempt on this today. Anyone else working on this?

tedfordgif’s picture

Status: Active » Needs review
StatusFileSize
new1.72 KB

Here'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.

davidseth’s picture

Hello @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.

davidseth’s picture

Status: Needs review » Reviewed & tested by the community

Tested patch at #8 and it works great. Thanks again @tedfordgif.

atlea’s picture

Tested, works for me as well. :)

brycesenz’s picture

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

drewish’s picture

Status: Reviewed & tested by the community » Needs work

Well at the very least the commented out dpm()s should be removed before this is committed.

drewish’s picture

Status: Needs work » Needs review
StatusFileSize
new2.15 KB

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

tedfordgif’s picture

I like this approach. Thanks for doing the research to get it right.

Alex_cabello’s picture

I have the same problem. I can not used computed fields in rules, so I subscribe!

drewish’s picture

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

xlyz’s picture

Status: Needs review » Reviewed & tested by the community

works for me

ptmkenny’s picture

I also had success making data comparisons after the patch. Thanks!

colan’s picture

Status: Reviewed & tested by the community » Needs work

I think it needs a re-roll.

colans@server31[Thu 26 14:21]% git am < /tmp/computed_field_1150184.patch
Applying: Issue #1150184 by tedfordgif and drewish: Add Entity API support to enable Search API integration.
error: computed_field.module: does not match index
Patch failed at 0001 Issue #1150184 by tedfordgif and drewish: Add Entity API support to enable Search API integration.
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
xlyz’s picture

I'm no expert of git am, but "patch < computed_field_1150184.patch" works fine.

maybe same problem reported here?

colan’s picture

Title: support entity api for rules & search_api integration » Support entity API for Rules & search_api integration
Status: Needs work » Fixed

Committed in 5503a0f. Thanks for the tip. "git am" needed a "--3way" switch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jlstrecker’s picture

Issue summary: View changes

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