You are here

function rules_data_condition_info in Rules 7.2

Implements hook_rules_condition_info() on behalf of the pseudo data module.

See also

rules_core_modules()

Related topics

File

modules/data.rules.inc, line 489
General data related rules integration.

Code

function rules_data_condition_info() {
  return array(
    'data_is' => array(
      'label' => t('Data comparison'),
      'parameter' => array(
        'data' => array(
          'type' => '*',
          'label' => t('Data to compare'),
          'description' => t('The data to be compared, specified by using a data selector, e.g. "node:author:name".'),
          'allow null' => TRUE,
        ),
        'op' => array(
          'type' => 'text',
          'label' => t('Operator'),
          'description' => t('The comparison operator.'),
          'optional' => TRUE,
          'default value' => '==',
          'options list' => 'rules_condition_data_is_operator_options',
          'restriction' => 'input',
        ),
        'value' => array(
          'type' => '*',
          'label' => t('Data value'),
          'description' => t('The value to compare the data with.'),
          'allow null' => TRUE,
        ),
      ),
      'group' => t('Data'),
      'base' => 'rules_condition_data_is',
    ),
    'data_is_empty' => array(
      'label' => t('Data value is empty'),
      'parameter' => array(
        'data' => array(
          'type' => '*',
          'label' => t('Data to check'),
          'description' => t('The data to be checked to be empty, specified by using a data selector, e.g. "node:author:name".'),
          'allow null' => TRUE,
          'wrapped' => TRUE,
        ),
      ),
      'group' => t('Data'),
      'base' => 'rules_condition_data_is_empty',
    ),
    'list_contains' => array(
      'label' => t('List contains item'),
      'parameter' => array(
        'list' => array(
          'type' => 'list',
          'label' => t('List', array(), array(
            'context' => 'data_types',
          )),
          'restriction' => 'selector',
        ),
        'item' => array(
          'type' => 'unknown',
          'label' => t('Item'),
          'description' => t('The item to check for.'),
        ),
      ),
      'group' => t('Data'),
      'base' => 'rules_condition_data_list_contains',
      'callbacks' => array(
        'info_alter' => 'rules_data_list_info_alter',
        'form_alter' => 'rules_data_list_form_alter',
      ),
    ),
    'list_count_is' => array(
      'label' => t('List count comparison'),
      'parameter' => array(
        'list' => array(
          'type' => 'list',
          'label' => t('List to check'),
          'description' => t('A multi value data element to have its count compared, specified by using a data selector, eg node:author:roles.'),
        ),
        'op' => array(
          'type' => 'text',
          'label' => t('Operator'),
          'description' => t('The comparison operator.'),
          'optional' => TRUE,
          'default value' => '==',
          'options list' => 'rules_condition_data_list_count_is_operator_options',
          'restriction' => 'input',
        ),
        'value' => array(
          'type' => 'integer',
          'label' => t('Count'),
          'description' => t('The count to compare the data count with.'),
        ),
      ),
      'group' => t('Data'),
      'base' => 'rules_condition_data_list_count_is',
    ),
    'text_matches' => array(
      'label' => t('Text comparison'),
      'parameter' => array(
        'text' => array(
          'type' => 'text',
          'label' => t('Text'),
          'restriction' => 'selector',
        ),
        'match' => array(
          'type' => 'text',
          'label' => t('Matching text'),
        ),
        'operation' => array(
          'type' => 'text',
          'label' => t('Comparison operation'),
          'options list' => 'rules_data_text_comparison_operation_list',
          'restriction' => 'input',
          'default value' => 'contains',
          'optional' => TRUE,
          'description' => t('In case the comparison operation @regex is selected, the matching pattern will be interpreted as a <a href="@regex-wikipedia">regular expression</a>.  Tip: <a href="@RegExr">RegExr: Online Regular Expression Testing Tool</a> is helpful for learning, writing, and testing Regular Expressions.', array(
            '@regex-wikipedia' => 'http://en.wikipedia.org/wiki/Regular_expression',
            '@RegExr' => 'http://gskinner.com/RegExr/',
            '@regex' => t('regular expression'),
          )),
        ),
      ),
      'group' => t('Data'),
      'base' => 'rules_data_text_comparison',
    ),
  );
}