You are here

function hook_rules_condition_info in Rules 6

Same name and namespace in other branches
  1. 7.2 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.

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

See also

hook_rules_action_info().

Related topics

8 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.

node_rules_condition_info in rules/modules/node.rules.inc
Implementation of hook_rules_condition_info()
path_rules_condition_info in rules/modules/path.rules.inc
Implementation of hook_rules_condition_info().
php_rules_condition_info in rules/modules/php.rules.inc
Implementation of hook_rules_condition_info().
rules_forms_rules_condition_info in rules_forms/rules_forms.rules.inc
Implementation of hook_rules_condition_info().
rules_rules_condition_info in rules/modules/rules.rules.inc
Implementation of hook_rules_condition_info().

... See full list

File

rules/rules.api.php, line 286
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_rules_condition_info() {
  return array(
    'rules_condition_text_compare' => array(
      'label' => t('Textual comparison'),
      'arguments' => array(
        'text1' => array(
          'label' => t('Text 1'),
          'type' => 'string',
        ),
        'text2' => array(
          'label' => t('Text 2'),
          'type' => 'string',
        ),
      ),
      'help' => t('TRUE is returned, if both texts are equal.'),
      'module' => 'Rules',
    ),
  );
}