User login


Show main menu links in the admin menu

* Alter the admin menu to show main menu links there also (for admin pages).
function example_admin_menu_output_alter(&$content) {
// Retrieve the Main menu link tree.
$tree = menu_build_tree('main-menu');
$links = admin_menu_links_menu($tree);
  if (!empty(
$links)) {
// Fake out a top-level main menu link.
$links['#title'] = t('Main menu');
$links['#href'] = '<front>';
$links['#options'] = array(
'alias' => true,
$links['#weight'] = 100;
$content['menu']['main_menu'] = $links;

Notes and links on hacking in a custom active state path for menu links

function feature_frontend_preprocess_links(&$variables) {

Faking an active trail for items not in a menu: Drupal 7 active state for main menu based on content type

Situation: You have lots of content that you don't really want in a menu at all, but you want to appear to be below or within a section of the site when you are viewing that content. For instance, when viewing news content the menu link for the overall views listing should appear to be active, or rather in the active path or trail.

Return user to current page: How to link to a form from a Drupal menu

Press login / press account links for anonymous and logged in users, respectively. Subtly added to a bottom menu. Via code in order to allow for the redirect back to the page you were on after login or editing.

There is surely a way, or should be a way, that does not involve hook_page_alter(), but hey, this works.

Active state of primary links should follow main sections even without menus

There is a hefty patch porting the MenuTrails module to Drupal 7, but it is reported to not work (read: cause fatal errors with) Organic Groups.

See also:

Saving the modules page no longer (necessarily) rebuilds menus

Here's the code in system_modules_submit() - the function called when admin/modules is saved - that skips over flushing caches if no modules are enabled or disabled:

Having the top-level menu items not be links (for use with dropdown menus)

The best approach may be to avoid this entirely with proper information architecture. I always try to make these have meaning themselves, but certainly with not expecting most people to click on them anyway, this does not always make sense. Instead, the way Agaricer Kathleen did it for one project is simply to have each dropdown be a separate menu.

But let's say you are stubborn and don't like that approach or are too far down the path of a big old nested primary links menu. What do you do? Call Agaric, of course (or find this web page).

Aquasoft / MGP-Forum style CSS background graphical menu for Drupal primary links

We first used this technique from the aquasoft theme on a 4.7 site, MGP-Forum, and just used it again, updated for Drupal 5 and with one enhancement by us.

Here's the D5 version from Aquasoft:

Show menu in page

Set the input format for your node body or other textarea to PHP code, figure out what the menu ID of the menu item you care about as described by Nick Lewis (from whom all of this is stolen), and then stick this in your content:

$html = theme_menu_tree(42);
print $html;

It could also go in a theme or somewhere else silly.


Breadcrumb control

Agaric would like breadcrumbs in Drupal to just work, but barring that until book navigation becomes general navigation in Drupal 6, we'd just like control...

Custom Breadcrumbs module

From the PHP snippet section...

Breadcrumbs including title

Syndicate content