You are here

function hook_rules_import in Rules 6

React on an import of a rule.

This hook is called if a rule is imported through the import/export admin interface or if a default rule is provided by a module via hook_rules_defaults().

Parameters

$rule: An array representing the rule with its properties.

Related topics

1 function implements hook_rules_import()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

rules_forms_rules_import in rules_forms/rules_forms.module
Implementation of hook_rules_import(). We need to activate the form event of the imported rule.
1 invocation of hook_rules_import()
rules_import_hook in rules/rules.module
Calls the import hook to allow modules to react on the import.

File

rules/rules.api.php, line 639
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_rules_import(&$rule) {

  // Examine the rule, e.g. check if it is event-triggered.
  if ($rule['#set'] === 'event_my_module') {

    // Initiate post-processing that is needed to make to rule work.
  }
}