function flag_action_info_alter in Flag 6.2
Same name and namespace in other branches
- 7.3 includes/flag.actions.inc \flag_action_info_alter()
- 7.2 includes/flag.actions.inc \flag_action_info_alter()
Implements hook_action_info_alter().
Enable Flag actions on Node, Comment, and User hooks without the trigger_unlock.module.
File
- includes/
flag.actions.inc, line 72 - Hooks for flag actions.
Code
function flag_action_info_alter(&$actions) {
$node_flags = flag_get_flags('node');
$comment_flags = flag_get_flags('comment');
$user_flags = flag_get_flags('user');
foreach ($actions as $name => $action) {
if (strpos($name, 'node') === 0) {
$actions[$name]['hooks']['flag'] = array(
'flag',
'unflag',
);
foreach ($node_flags as $flag) {
$actions[$name]['hooks']['flag'][] = 'flag_' . $flag->name;
$actions[$name]['hooks']['flag'][] = 'unflag_' . $flag->name;
}
}
if (strpos($name, 'comment') === 0) {
$actions[$name]['hooks']['flag'] = array(
'flag',
'unflag',
);
foreach ($comment_flags as $flag) {
$actions[$name]['hooks']['flag'][] = 'flag_' . $flag->name;
$actions[$name]['hooks']['flag'][] = 'unflag_' . $flag->name;
}
}
if (strpos($name, 'user') === 0) {
$actions[$name]['hooks']['flag'] = array(
'flag',
'unflag',
);
foreach ($user_flags as $flag) {
$actions[$name]['hooks']['flag'][] = 'flag_' . $flag->name;
$actions[$name]['hooks']['flag'][] = 'unflag_' . $flag->name;
}
}
}
}