You are here

function webmaster_menu_page_alter in Webmaster menu 7

Implements hook_page_alter().

File

./webmaster_menu.module, line 53
Display a dropdown menu at the top of the window.

Code

function webmaster_menu_page_alter(&$page) {

  // Do not show menu, if user hasn't access to it
  if (!webmaster_menu_enabled()) {
    return '';
  }

  // Do not display with core overlay, this creates duplicates menus, one in the
  // main page and one in the overlay iframe
  if (function_exists('overlay_get_mode')) {
    if (overlay_get_mode() == 'child') {
      return FALSE;
    }
  }

  // Do not show menu on dialog page in the "media" module.
  if ($page['#theme'] == 'media_dialog_page') {
    return '';
  }

  // Do not show menu on dialog created by references dialog module (https://drupal.org/project/references_dialog)
  if ($page['#theme'] == 'references_dialog_page') {
    return '';
  }
  $page['page_top']['webmaster_menu'] = array(
    '#markup' => webmaster_menu_output(),
    '#weight' => -50,
  );
  $settings = array(
    'has_admin_menu' => module_exists('admin_menu'),
  );
  $page['page_top']['webmaster_menu']['#attached']['js'][] = array(
    'data' => array(
      'webmaster_menu' => $settings,
    ),
    'type' => 'setting',
  );
  if (variable_get('webmaster_menu_positioning', 'fixed') == 'fixed') {
    drupal_add_js(drupal_get_path('module', 'webmaster_menu') . '/webmaster_menu_fixed.js');
  }
  else {
    if (module_exists('admin_menu') || module_exists('toolbar')) {
      drupal_add_js(drupal_get_path('module', 'webmaster_menu') . '/webmaster_menu_relative.js');
    }
  }
}