You are here

function hook_rules_defaults in Rules 6

Provides a default rule.

Modules that implement this hook have to provide a configuration array that contains rules and/or rule sets. You can use the output from the export functionality, but you have to change rules and rule sets names and you need to set the status property to 'default' or 'fixed'.

Return value

An array containing the configuration.

See also

http://drupal.org/node/298634

Related topics

1 function implements hook_rules_defaults()

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

rules_test_rules_defaults in rules_test/rules_test.rules_defaults.inc
Implementation of hook_rules_defaults.

File

rules/rules.api.php, line 659
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_defaults() {
  $config = array(
    'rules' => array(
      // A default rule.
      'yourmodule_default_rule_1' => array(
        '#status' => 'default',
      ),
      // A fixed rule (hidden from the Rules admin user interface).
      'yourmodule_default_rule_2' => array(
        '#status' => 'fixed',
      ),
    ),
    'rule_sets' => array(
      // A default rule set.
      'yourmodule_default_set_1' => array(
        'status' => 'default',
      ),
      // A fixed rule set (hidden from the Rules admin user interface).
      'yourmodule_default_set_2' => array(
        'status' => 'fixed',
      ),
    ),
  );
  return $config;
}