function flag_rules_condition_info in Flag 7.2
Same name and namespace in other branches
- 6.2 includes/flag.rules.inc \flag_rules_condition_info()
- 6 includes/flag.rules.inc \flag_rules_condition_info()
- 7.3 flag.rules.inc \flag_rules_condition_info()
Implements hook_rules_condition_info().
File
- ./
flag.rules.inc, line 344 - Rules integration for the Flag module.
Code
function flag_rules_condition_info() {
$items = array();
foreach (flag_get_types() as $type) {
$flag = flag_create_handler($type);
$entity_info = entity_get_info($type);
$label = isset($entity_info[$type]['label']) ? $entity_info[$type]['label'] : $type;
$items += array(
'flag_threshold_' . $type => array(
'label' => drupal_ucfirst(t('@type has flagging count', array(
'@type' => $label,
))),
'base' => 'flag_rules_condition_threshold',
'parameter' => array(
'flag' => array(
'type' => 'flag',
'label' => t('Flag'),
'flag_type' => $type,
'description' => t('The flag to check for.'),
),
$type => array(
'type' => $type,
'label' => $label,
),
'number' => array(
'type' => 'integer',
'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.'),
),
'operator' => array(
'type' => 'text',
'label' => t('Comparison operator'),
'options list' => 'flag_rules_condition_threshold_operator_options',
'restriction' => 'input',
'default value' => '=',
'optional' => TRUE,
),
),
'group' => t('Flag'),
'access callback' => 'flag_rules_integration_access',
),
'flag_flagged_' . $type => array(
'label' => drupal_ucfirst(t('@type is flagged', array(
'@type' => $label,
))),
'base' => 'flag_rules_condition_flagged',
'parameter' => array(
'flag' => array(
'type' => 'flag',
'label' => t('Flag'),
'flag_type' => $type,
'description' => t('The flag to check for.'),
),
$type => array(
'type' => $type,
'label' => $label,
),
'flagging_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.'),
),
),
'group' => t('Flag'),
'access callback' => 'flag_rules_integration_access',
),
);
}
return $items;
}