Extend Rules

Last updated on
30 November 2019

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Rules may be extended via new Rules plugins, input evaluators and data processors.

Providing further Rules plugins

Rules comes with plugins like reaction rules, rules, rule sets, actions sets, condition set (or) and condition set (and) or a loop. Modules may provide further plugins, e.g. to implement other kind of loops. The Rules Transformers module uses that to implement a pipeline plugin which just works like an action set but implements its own UI.

To implement a new plugin, implement hook_rules_plugin_info() and provide a class for your plugin that inherits from RulesPlugin, the RulesActionContainer, the RulesConditionContainer or any other suiting class that inherits from RulesPlugin.

Providing further input evaluators

Input evaluators may process the direct data input values given by users. Rules implements input evaluators for token replacements and PHP evaluation, but also an evaluator to convert strtotime() suiting "date strings" into timestamps.

To provide an input evaluator implement hook_rules_evaluator_info() and provide an implementation class that inherits from RulesDataInputEvaluator.

Providing further data processors

Data processors are for processing the values resulting from the configured data selection - Rules implements a processor for applying offsets to date values as well as a custom-PHP-code processor. To provide another processor implement hook_rules_data_processor_info() and provide an implementation class that inherits from RulesDataProcessor.

The following figure provides an overview of the possible argument value configuration modes of Rules, including data processors and input evaluators:

configuration modes

Help improve this page

Page status: No known problems

You can: