CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Mod to quickly switch between admin menu & navigation menu and remove Home link
Pages: [1]

Author Topic: Mod to quickly switch between admin menu & navigation menu and remove Home link  (Read 1172 times)

jsherk

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 0
Mod to quickly switch between admin menu & navigation menu and remove Home link
May 01, 2010, 11:53:56 am
I like the fact that there is a link under Home that says Drupal Menu which allows you to switch over to the Drupal Admin Menu (admin_menu module). What i don't like is the fact that I need to click twice to get there!

So here is a one line mod that moves Drupal Menu to the top layer of the navigation menu...

Using CiviCRM version 3.1.4 , open the file CRM/Core/BAO/Navigation.php and look around line 531 for this:
Code: [Select]
            if ( ( $config->userFramework == 'Drupal' ) &&
                 function_exists( 'module_exists' ) &&
                 module_exists('admin_menu') ) {
                $prepandString = "<li class=\"menumain\">" . ts('Home') . "<ul id=\"civicrm-home\"><li><a href=\"{$homeURL}\">" . ts('CiviCRM Home') . "</a></li><li><a href=\"#\" onclick=\"cj.Menu.closeAll( );cj('#civicrm-menu').toggle( );\">" . ts('Drupal Menu') . "</a></li></ul></li>";
            } else {
                $prepandString = "<li class=\"menumain\"><a href=\"{$homeURL}\" title=\"" . ts('CiviCRM Home') . "\">" . ts('Home') . "</a></li>";
            }

And change it to this:
Code: [Select]
            if ( ( $config->userFramework == 'Drupal' ) &&
                 function_exists( 'module_exists' ) &&
                 module_exists('admin_menu') ) {
                $prepandString = "<li class=\"menumain\">" . ts('Home') . "<ul id=\"civicrm-home\"><li><a href=\"{$homeURL}\">" . ts('CiviCRM Home') . "</a></li><li><a href=\"#\" onclick=\"cj.Menu.closeAll( );cj('#civicrm-menu').toggle( );\">" . ts('Drupal Menu') . "</a></li></ul></li>";
                //MOD move Drupal Menu to top layer of navigation menu
                $appendSring = "<li class=\"menumain\"><a href=\"#\" onclick=\"cj.Menu.closeAll( );cj('#civicrm-menu').toggle( );\">" . ts('Drupal Menu') . "</a></li>" . $appendSring;
                //end MOD
            } else {
                $prepandString = "<li class=\"menumain\"><a href=\"{$homeURL}\" title=\"" . ts('CiviCRM Home') . "\">" . ts('Home') . "</a></li>";
            }

And that's it!!!

Now if you want to completely remove the HOME link from the Navigation Menu, in the same code above, you need to comment out both occurences of $prepandString and replace them an empty string, like this:

Code: [Select]
            if ( ( $config->userFramework == 'Drupal' ) &&
                 function_exists( 'module_exists' ) &&
                 module_exists('admin_menu') ) {
                //MOD remove HOME menu
                //$prepandString = "<li class=\"menumain\">" . ts('Home') . "<ul id=\"civicrm-home\"><li><a href=\"{$homeURL}\">" . ts('CiviCRM Home') . "</a></li><li><a href=\"#\" onclick=\"cj.Menu.closeAll( );cj('#civicrm-menu').toggle( );\">" . ts('Drupal Menu') . "</a></li></ul></li>";
                $prepandString = "";
                //MOD end MOD
                //MOD move Drupal Menu to top layer of navigation menu
                $appendSring = "<li class=\"menumain\"><a href=\"#\" onclick=\"cj.Menu.closeAll( );cj('#civicrm-menu').toggle( );\">" . ts('Drupal Menu') . "</a></li>" . $appendSring;
                //end MOD
            } else {
                //MOD remove HOME menu
                //$prepandString = "<li class=\"menumain\"><a href=\"{$homeURL}\" title=\"" . ts('CiviCRM Home') . "\">" . ts('Home') . "</a></li>";
                $prepandString = "";
                //end MOD
            }

Hope this is useful to somebody!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Mod to quickly switch between admin menu & navigation menu and remove Home link

This forum was archived on 2017-11-26.