Voting starts in March for the Drupal Association Board election.
The data selection input method allows you to drill down into the data available to Rules, in that particular context. One important benefit from data selection is the ability to explore chained variables – for example
node:author:… will show you data for a node's author, without the author's user object being explicitly loaded into Rules.
- If selecting an item ending with ':' you can access data inside that object, creating chains of related data.
- Modules like References and Entity Reference will provide connections between entities, such as
- If you are expected to provide data of a certain type, the data selector will only list data end points matching these requirements. For example, if you are using an action to set a node title, Rules will only accept data of the type 'text'.
The direct input mode is most useful when entering a new text token, rather than another available data variable. You can use all chains of data found with the data selector as tokens in direct input mode. For example, you can use [user:field_node_reference:nid] as a token representing the node ID of a referenced node.
- Tokens support is currently missing, see .
Rules uses an incredibly extensible plugin system to support multiple types of data input interfaces. You can read more about this API and how to add additional data selection interfaces in the developer documentation section on data types.
Lists and items within them are also types of data which can be selected.
Selection of custom fields
For entities with custom fields, you must first create a condition that sets the entity bundle type, this will allow Rules to determine the fields available for the bundle, which can then be used for comparison, etc.
To do this, add a first condition to your rule as follows:
- From the 'Select the condition to add' input, select Entities > Entity is of bundle.
- Press Continue
- From the 'Data selector' input select the entity you are targeting (don't use the entity with the colon, e.g. Person, not Person:).
- Press Continue.
- You should now see a new 'Entity Bundle' fieldset, select the bundle name that you want to compare field values from.
- Press Save.
Now you can add additional conditional rules that have access to all of the custom fields belonging to the bundle you referenced in step 5.
NB The field type you created needs to match the field type that is expected, otherwise it will not show in the selector, eg if you have a Date field, but the entity is expecting a text field!