You are here

function hook_default_rules_configuration in Rules 7.2

Define default rules configurations.

This hook is invoked when rules configurations are loaded. The implementation should be placed into the file MODULENAME.rules_defaults.inc, which gets automatically included when the hook is invoked.

Return value

array An array of rules configurations with the configuration names as keys.

See also

hook_default_rules_configuration_alter()

hook_rules_config_defaults_rebuild()

Related topics

1 function implements hook_default_rules_configuration()

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

rules_test_default_rules_configuration in tests/rules_test.rules_defaults.inc
Implements hook_default_rules_configuration().

File

./rules.api.php, line 866
Documentation for hooks provided by the Rules API.

Code

function hook_default_rules_configuration() {
  $rule = rules_reaction_rule();
  $rule->label = 'example default rule';

  // Add rules tags.
  $rule->tags = array(
    'Admin',
    'Tag2',
  );
  $rule->active = FALSE;
  $rule
    ->event('node_update')
    ->condition(rules_condition('data_is', array(
    'data:select' => 'node:status',
    'value' => TRUE,
  ))
    ->negate())
    ->condition('data_is', array(
    'data:select' => 'node:type',
    'value' => 'page',
  ))
    ->action('drupal_message', array(
    'message' => 'A node has been updated.',
  ));
  $configs['rules_test_default_1'] = $rule;
  return $configs;
}