You are here

function content_menu_page_alter in Content Menu 8

Same name and namespace in other branches
  1. 7 content_menu.module \content_menu_page_alter()

Implements hook_page_alter().

Set consistent menu admin breadcrumbs on pages other than menu admin forms.

File

./content_menu.module, line 93

Code

function content_menu_page_alter(&$page) {
  $menu_paths = array(
    'admin/structure/menu/',
    'admin/structure/menu-position/',
    content_menu_variable_get_add_existing_content_url(),
  );
  $path = current_path();
  foreach ($menu_paths as $menu_path) {
    if (strpos($path, $menu_path) === 0) {
      content_menu_set_menu_admin_breadcrumb();
      break;
    }
  }
  if (current_path() == content_menu_variable_get_add_existing_content_url()) {
    $item = content_menu_get_menu_item_from_querystring();
    if (isset($item['mlid']) && $item['mlid'] != 0) {
      drupal_set_message(t('You`re about to select a new content target for menu item "%title".', array(
        '%title' => $item['title'],
      )));
      drupal_set_message(t('Now you can select an existing content item for menu item "%title".', array(
        '%title' => $item['title'],
      )));
    }
  }
}