Insert into rules.api.php, in hook_default_rules_configuration:
$rule = rules_reaction_rule();
$rule->label = 'example default rule';
$rule->tags = array('Admin', 'Tag2'); // <- insert this
$rule->active = FALSE;
$rule->event('node_update')
//...
I figured it out, but it would have been even easier with an example to follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1917772-2.patch | 1.15 KB | tr |
Comments
Comment #1
tr commentedI just added that to the documentation. See Default rules
Of course, you know you could have done that yourself years ago, right?
I'm also adding it to the Rules test module, rules_test, found in the tests directory of your Rules distribution. The testing code serves as the definitive developer documentation because it is intended that the tests try out and verify all features of Rules, including in this case programmatic Rules configuration creation. When a feature is not being tested, like adding tags, then we should be adding a test to ensure that feature works and to provide an example of how to use that feature.
So in addition to the documentation fix, here's a patch for the rules_test module.
Comment #3
tr commentedOK, that worked. Committed.