User login

Menu

Making it so code-provided menu links can have their titles edited

This link is provided by the module. "The title and path cannot be edited." Drupal 8

https://www.drupal.org/node/2838106#comment-12269503

This issue is about fixing the home link in the standard profile. We should let that fix go in. That said, i'm with those saying we (also) need a general solution for this.

Show main menu links in the admin menu

<?php
/**
 * 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;
   
debug($links);
   
$content['menu']['main_menu'] = $links;
  }
}
?>

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

<?php
function feature_frontend_preprocess_links(&$variables) {
 
kpr($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: http://data.agaric.com/breadcrumb-control

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:

<?php
$html = theme_menu_tree(42);
print $html;
?>

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

Resolution

Syndicate content