Steven Matthews
Steven Matthews

Reputation: 11325

Complex Rule in Drupal involving multiple entities

I need to create a fairly complex rule in Drupal - I am willing to use either code or the interface to do so.

I am more familiar with the interface, however, as opposed to the Rules API.

Anyway, the rule will be as follows:

It will happen based on a form submission from entityforms (which is one entity). It will take the checkbox value of a field (not just the true or false, but rather the value submitted when a value is true or false). It will convert this number to an integer.

At this point things get interesting - I want to create a new entity of registrations (a different entity), which as far as I can tell, means I'll have to bring a registration into scope. I also need to bring node (and not just node: type and other data selectors, but specifically node) into scope, because the next step requires it.

So at this point, I should have three entities loaded into scope:

entityforms
registration
node

I believe the best way to bring registration into scope would be entity is of type? The documentation page says that content of type should be appropriate - but that seems like it might be related to the specific use case of the example - not in my more complex example where registration isn't the first entity dealt with, but rather a second.

https://drupal.org/node/1463042

So anyway, if all three of these entities is called in correctly, the ultimate result should be the following:

Value from boolean field (not the straight 1 or 0, but whatever the value to be submitted is switched to) from the entityform is converted to an integer, and inserted where entity host ID is required. In the section where host entity type is the value should be node.

I am also open to alternative suggestions if this seems overly complex or poorly architected.

Upvotes: 0

Views: 673

Answers (1)

TheodorosPloumis
TheodorosPloumis

Reputation: 2456

The Host Entity Type cannot be of Entityform? Why be a Node since a Registration can be attached to any entity? Then you will get the id of the Entityform as also as any other fields from that entity type instead of Node. Next steps are the same.

Upvotes: 1

Related Questions