If a module wants to hook into reply and use the entity api to set particular properties it is not able to do so since the 'setter callback' has not been defined. This prevents modules like rules from being able to set useful properties such as 'status' etc ... Or create reply entities on the fly.

I also added an options list for the entity_type property field so that it will be usable in views filters, rules, etc.

Comments

acrazyanimal’s picture

edit: this patch is missing the options callback so ignore it, its no good.

acrazyanimal’s picture

Priority: Normal » Major
StatusFileSize
new2.04 KB

Woops forgot to merge in the options callback. Here is a working patch.

james.williams’s picture

I'm not sure how useful this is ... I applied the patch, but I still couldn't create reply entities with Rules, and the individual properties still seem available to Rules without the patch?

Can you outline a testable situation that the patch solves?

acrazyanimal’s picture

Did you try using the 'set data value' rule on any of the properties all the way to completion? When I tried, after selecting a particular property and clicking continue, it brought me back to the same selection screen with a message "status cannot be set" or something like that. Also, I found that not all the properties were present in the list.

Here is a test:

Use an event like 'Reply is saved'
action: "set a data value" - choose 'status' from the data selection widget.
click continue
You should now see the error regarding not being able to set it.

This same error is received for all the properties as far as I can remember.

The patch also adds a options list callback for entity types rather then having to type in the machine name of an entity type.

I was able to create a reply through rules using a create entity rule in combo with a series of set a data value to select the entity type and entity id properties, etc.

Hope that all helps.

acrazyanimal’s picture

I'd like to point out that this isn't just a rules thing. It will also help in views integration, VBO, view modes, custom edit interfaces for replies that another contrib module developer may wish to create, etc.

mgifford’s picture

Patch no longer applies (against git master branch):

$ git apply reply-add-setget-property-callbacks-1599038-1.patch
error: patch failed: reply.module:1708
error: reply.module: patch does not apply

a.ross’s picture

StatusFileSize
new1.53 KB

Here's the patch rerolled against the latest revision. It gets us a little further, but I still wasn't able to create entities, since I can't choose bundle type.

pameeela’s picture

Category: Bug report » Task
Priority: Major » Normal
Issue summary: View changes