When configuring Rules for performing tasks on your website, it doesn't take very long before you feel that you want to use certain sets of conditions or actions over and over again. Luckily it is possible to save and reuse configurations.

Reusing Rules configuration is done by creating components. All your website's Rules components and a link to create new ones, are found at a separate tab in the Rules overview. (See figure 12.9) In a default installation you can create five different types of Rules components:

  • Condition set (OR): This is a group of one or several conditions, where only one must be true for the group to be evaluated TRUE.
  • Condition set (AND): This is a group of one or several conditions, where all must be true for the group to be evaluated TRUE.
  • Action set: This is a group of actions.
  • Rule: This creates a rule without any triggering event. Instead it must be called explicitly from other parts of Rules or the website in general.
  • Rule set: This creates a group of rules, executed in sequence. Rule sets don't have any triggering events.


Figure 12.9: You can create isolated Rules components, for use and reuse on other parts of your site.

Every type of component is created and managed in way similar to their respective parts in reaction rules, with one important difference. Each component has settings for which objects/variables must be included when the component is called. (See figure 12.10) These objects are selected when calling the component and are then available for the component to work with.


Figure 12.10: When creating components, you set which types of objects the component should work with. In order to call the component from other parts of Rules, you must have matching objects available.

Components are not only useful for reusing configurations, but also for exporting Rules configuration efficiently. See the section on configuration export in Appendix 1 for details about why configuration export is so useful.

The Views Bulk Operations module can be used to execute rules on nodes and other entities. This allows for creating highly customized actions, which site administrators can use to (for example) mark selected articles as reviewed, publish them, and send a message to the author.

AttachmentSize
11.9 components 1.png38.65 KB
11.10 component variables.png22.22 KB