You are here

function hook_rules_condition_info in Rules 7.2

Same name and namespace in other branches
  1. 6 rules/rules.api.php \hook_rules_condition_info()

Define rules conditions.

This hook is required in order to add a new rules condition. It should be placed into the file MODULENAME.rules.inc, which gets automatically included when the hook is invoked.

However, as an alternative to implementing this hook, class based plugin handlers may be provided by implementing RulesConditionHandlerInterface. See the interface for details.

Adding conditions works exactly the same way as adding actions, with the exception that conditions can't provide variables and cannot save parameters. Thus the 'provides' attribute is not supported. Furthermore the condition implementation callback has to return a boolean value.

See also

hook_rules_action_info()

Related topics

2 functions implement hook_rules_condition_info()

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

rules_rules_condition_info in ./rules.rules.inc
Implements hook_rules_condition_info().
rules_test_rules_condition_info in tests/rules_test.rules.inc
Implements hook_rules_condition_info().

File

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

Code

function hook_rules_condition_info() {
  return array(
    'rules_condition_text_compare' => array(
      'label' => t('Textual comparison'),
      'parameter' => array(
        'text1' => array(
          'label' => t('Text 1'),
          'type' => 'text',
        ),
        'text2' => array(
          'label' => t('Text 2'),
          'type' => 'text',
        ),
      ),
      'group' => t('Rules'),
    ),
  );
}