/** * 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 * An array of rules configurations with the configuration names as keys. * * @see hook_default_rules_configuration_alter() * @see hook_rules_config_defaults_rebuild() */ function hook_default_rules_configuration() { $rule = rules_reaction_rule(); $rule->label = 'example default rule'; $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; }
/** * Example of chained method invocations in a function. */ function test3() { // Uses the Rules API as example. $rule = rule(); $rule->condition('rules_test_condition_true')->condition('rules_test_condition_true')->condition(rules_or()->condition(rules_condition('rules_test_condition_true')->negate())->condition('rules_test_condition_false')->condition(rules_and()->condition('rules_test_condition_false')->condition('rules_test_condition_true')->negate())); }