function userpoints_menu_local_tasks_alter in User Points 7
Same name and namespace in other branches
- 7.2 userpoints.module \userpoints_menu_local_tasks_alter()
Implements hook_menu_local_tasks_alter().
File
- ./
userpoints.module, line 324
Code
function userpoints_menu_local_tasks_alter(&$data, $router_item, $root_path) {
// Add action link to add points on 'userpoints' administration pages.
if (strpos($root_path, 'admin/config/people/userpoints/') !== FALSE) {
// Don't display the action link on some pages like settings and
// approve or decline confirmation forms.
$blacklist = array(
'settings',
'approve',
'decline',
);
foreach ($blacklist as $blacklisted_path) {
if (strpos($root_path, $blacklisted_path) !== FALSE) {
return;
}
}
$item = menu_get_item('admin/config/people/userpoints/add');
// For the transaction view pages, we want to directly link to the
// user for this transaction.
if (arg(4) == 'transaction' && (arg(6) == 'view' || arg(6) == 'edit')) {
$transaction = userpoints_transaction_load(arg(5));
$item['href'] .= '/' . $transaction->uid;
}
if ($item['access']) {
$data['actions']['output'][] = array(
'#theme' => 'menu_local_action',
'#link' => $item,
);
}
}
}