function flag_rules_event_info in Flag 6
Same name and namespace in other branches
- 6.2 includes/flag.rules.inc \flag_rules_event_info()
- 7.3 flag.rules.inc \flag_rules_event_info()
- 7.2 flag.rules.inc \flag_rules_event_info()
Implementation of hook_rules_event_info().
File
- includes/
flag.rules.inc, line 79 - flag.rules.inc Rules integration for the Flag module.
Code
function flag_rules_event_info() {
$items = array();
$flags = flag_get_flags();
foreach ($flags as $flag) {
$arguments = array(
// First, define ubiquitous arguments.
'flag' => array(
'type' => 'flag',
'label' => t('flag'),
),
'flag_content_id' => array(
'type' => 'number',
'hidden' => TRUE,
),
'flagging_user' => array(
'type' => 'user',
'label' => t('flagging user'),
),
);
// Then, define flag-specific arguments.
$arguments += $flag
->rules_get_event_arguments_definition();
// For each flag we define two events.
$items['flag_flagged_' . $flag->name] = array(
'module' => 'Flag',
'label' => t('A @flag-type has been flagged, under "@flag-title"', array(
'@flag-title' => $flag
->get_title(),
'@flag-type' => t($flag->content_type),
)),
'arguments' => $arguments,
);
$items['flag_unflagged_' . $flag->name] = array(
'module' => 'Flag',
'label' => t('A @flag-type has been unflagged, under "@flag-title"', array(
'@flag-title' => $flag
->get_title(),
'@flag-type' => t($flag->content_type),
)),
'arguments' => $arguments,
);
}
return $items;
}