You are here

function ad_menu_local_tasks_alter in Advertisement 7.3

Implements hook_menu_local_tasks_alter().

Add a link to the stats to the node tabs, for ads only.

File

./ad.module, line 106
Core code for the ad module.

Code

function ad_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  if (strpos($root_path, 'node/%') === 0) {
    foreach ($router_item['page_arguments'] as $item) {
      if (!empty($item->type) && ad_is_node_ad($item)) {
        $data['tabs'][0]['output'][] = array(
          '#theme' => 'menu_local_task',
          '#link' => array(
            'title' => t('Ad Stats'),
            'href' => 'admin/ad/stats/' . $item->nid,
            'localized_options' => array(
              'attributes' => array(
                'title' => t('Ad Stats'),
              ),
            ),
          ),
        );
      }
    }
  }
}