You are here

function privatemsg_menu_local_tasks_alter in Privatemsg 7.2

Same name and namespace in other branches
  1. 7 privatemsg.module \privatemsg_menu_local_tasks_alter()

Implements hook_menu_local_tasks_alter().

File

./privatemsg.module, line 324
Allows users to send private messages to other users.

Code

function privatemsg_menu_local_tasks_alter(&$data, $router_item, $root_path) {

  // Add action link to 'messages/new' on 'messages' page.
  $add_to_array = array(
    'messages/list',
    'messages/inbox',
    'messages/sent',
  );
  foreach ($add_to_array as $add_to) {
    if (strpos($root_path, $add_to) !== FALSE) {
      $item = menu_get_item('messages/new');
      if ($item['access']) {
        $data['actions']['output'][] = array(
          '#theme' => 'menu_local_action',
          '#link' => $item,
        );
      }
      break;
    }
  }
}