function rule
Creates a new rule.
Parameters
array $variables: The array of variables to setup in the evaluation state, making them available for the configuration elements. Values for the variables need to be passed as argument when the rule is executed. Only Rule instances with no variables can be embedded in other configurations, e.g. rule sets. The array has to be keyed by variable name and contain a sub-array for each variable that has the same structure as the arrays used for describing parameters of an action, see hook_rules_action_info(). However, in addition to that the following keys are supported:
- parameter: (optional) If set to FALSE, no parameter for the variable is created - thus no argument needs to be passed to the rule for the variable upon execution. As a consequence no value will be set initially, but the "Set data value" action may be used to do so. This is in particular useful for defining variables which can be provided to the caller (see $provides argument) but need not be passed in as parameter.
array $provides: The names of variables which should be provided to the caller. Only variables contained in $variables may be specified.
Return value
23 calls to rule()
- RulesI18nTestCase::testRulesConfigTranslation in rules_i18n/
rules_i18n.test - Tests translating rules configs.
- RulesIntegrationTestCase::testDataIntegration in tests/
rules.test - Tests data integration.
- RulesIntegrationTestCase::testEntityIntegration in tests/
rules.test - Tests entity related integration.
- RulesIntegrationTestCase::testPHPIntegration in tests/
rules.test - Tests integration for the php module.
- RulesIntegrationTestCase::testRulesCoreIntegration in tests/
rules.test - Tests the "rules_core" integration.
7 string references to 'rule'
- hook_rules_plugin_info in ./
rules.api.php - Defines rules plugins.
- rules_drush_command in ./
rules.drush.inc - Implements hook_drush_command().
- rules_rules_plugin_info in ./
rules.module - Implements hook_rules_plugin_info().
- rules_upgrade_convert_element in includes/
rules.upgrade.inc - Convert a single element.
- rules_upgrade_convert_rule_set in includes/
rules.upgrade.inc - Converts a single rule set, including all of its rules.
File
-
./
rules.module, line 128
Code
function rule($variables = NULL, $provides = array()) {
return rules_plugin_factory('rule', $variables, $provides);
}