Closed (fixed)
Project:
Rules
Version:
7.x-2.x-dev
Component:
Rules Core
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Apr 2011 at 19:53 UTC
Updated:
26 May 2012 at 17:08 UTC
I'm trying to add Rules integration to the Relation module.
After reading the docs http://drupal.org/node/906482, I find "now necessary to specify all needed arguments in the action info."
This makes sense, but since I'm dealing with an entity, it's my understanding that the action is already defined by the entity API. I'm not sure how to proceed or where to read further.
I tried looking at this list http://drupal.org/project/issues-term/750 for another module working with entities to find an example to work from, but couldn't find one.
I would appreciate any pointers to where I could read further.
Comments
Comment #1
Letharion commentedNot sure which component is the proper one, but forms support looked wrong.
Comment #2
dasjohi letharion,
what exactly do you mean by "add rules integration to the relation module"?
as you state and afaik, rules comes with entity integration (some actions and conditions) out of the box.
see http://drupalcode.org/project/rules.git/blob/refs/heads/7.x-2.x:/modules...
an example for adding entity related events can be found in the patch for
#1005128: Rules integration & enable modules to customize imports
regards
Comment #3
Letharion commentedThank you for your reply :)
I've done some experimentation myself since I opened the ticket, and here's where I'm at.
After adding a 'creation callback' to the entity metadata, Rules properly picks this up, and allows me to add the "Create new entity of type: Relation" action to my Rule.
What I'm still trying to figure out however, is how to get a proper arguments form into the UI.
When creating Relations manually, one needs to provide 1) a predicate, and 2) the which entities should become related.
Currently, I have no way of adding this configuration in the Rules UI.
Based on how Rules implements this for the core nodes, I've tried changing the parameters array into something like this:
This is to crude to be usable, but I used it to try and figure out how to control the UI at all. No dice.
Comment #4
Letharion commentedHopefully this is a more precise title.
Comment #5
Letharion commentedSpelling correction.
Comment #6
fagoYou'll need to declare entity-info for your properties. Every property that is marked with 'required' => TRUE in the property info, automatically shows up in the entity_create form. Others can be set after creation via the data_set action.
I noted parts of the rules docs were out of date and updated them. See http://drupal.org/node/878880.
We might want add some details specifically about adding a new entity type somewhere though.
Comment #7
fagook, I also added this to http://drupal.org/node/878880
Comment #9
mitchell commentedUpdated component.