function flag_rules_condition_info in Flag 6.2
Same name and namespace in other branches
- 6 includes/flag.rules.inc \flag_rules_condition_info()
- 7.3 flag.rules.inc \flag_rules_condition_info()
- 7.2 flag.rules.inc \flag_rules_condition_info()
Implementation of hook_rules_condition_info().
File
- includes/
flag.rules.inc, line 278 - Rules integration for the Flag module.
Code
function flag_rules_condition_info() {
$items = array();
foreach (flag_get_types() as $type) {
$args = array(
'flag' => array(
'type' => 'flag',
'label' => t('Flag'),
'flag_type' => $type,
),
);
$flag = flag_create_handler($type);
if ($flag
->rules_get_element_argument_definition()) {
$args += array(
'object' => $flag
->rules_get_element_argument_definition(),
);
$items += array(
'flag_rules_condition_threshold_' . $type => array(
'label' => drupal_ucfirst(t('@type has flagging count', array(
'@type' => $type,
))),
'base' => 'flag_rules_condition_threshold',
'label callback' => 'flag_rules_condition_threshold_label',
'arguments' => $args + array(
'number' => array(
'type' => 'number',
'label' => t('Number'),
'description' => t('The number against which to test the number of times the object is flagged. For example, if you type "3" here, and choose "Greater than" for the operator, then this condition will return TRUE if the object is flagged more than three times.'),
),
),
'module' => 'Flag',
),
'flag_rules_condition_flagged_' . $type => array(
'label' => drupal_ucfirst(t('@type is flagged', array(
'@type' => $type,
))),
'base' => 'flag_rules_condition_flagged',
'label callback' => 'flag_rules_condition_flagged_label',
'arguments' => $args + array(
'user' => array(
'type' => 'user',
'label' => t('User on whose behalf to check'),
'description' => t('For non-global flags, this is the user on whose behalf the flag is checked.'),
),
),
'module' => 'Flag',
),
);
}
}
return $items;
}