Get record ID in _headerModuleList.tpl (CE)

I'm trying to customize the very top navigation menu and figured out everything except for how to get the module name and record ID inside _headerModuleList.tpl (template which generates the top navigation bar)

What I tried:

- Calling $_REQUEST inside .tpl file, but since the URL contains a # it seems like the module name, record etc. are generated by JS

- Calling $bean->id, $focus->id etc.

- Setting up a custom view then defining module/record id as a smarty variable > defining a custom header in metadata for that view > reading that smarty variable inside the custom header. Problem is that it seems like we can only specify a custom 'headerTpl', but not a custom 'headerModuleList.tpl'

- Tried all relevant smarty loops inside "_headerModuleList.tpl"


May be a powerhouse like Francesca Shiekh , drifterjack drifterjack, Ara Gon would be kind enough to share their experience with this

There's surprisingly very little documentation on this except for standard modifications via admin interface

Parents
  • With which version do you work?

    In CE resp versions < 7 you do not have a "#" in the URL.

    In versions >= 7 you have "#" in the URL but no _headerModuleList.tpl

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

  • It would help to know what you are trying to achieve.

    In the meantime take a look at this page by Angel Magana, it is a little older but still valid as far as I know:

    Angel's Blog: SugarCRM Reference: Dissecting the NavBar 

    And this support document:

    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_8.1/User_Interface/MegaMenu/ 

    FrancescaS

  • Hi Francesca, thank you for the reply and just wanted to say I learned a lot from your other posts!

    I'm using Community Edition 6.5, so unfortunately there's no ./clients/base/layouts/header/header.php

    I'm trying to customize the top header based on the department chosen by the user. So after the user clicks on department X the system will set a cookie and keep showing a custom header related to that department until the visitor chooses a different department.

    I can set and read the cookie in _headerModuleList.tpl when the user clicks on a specific department, the problem is tricky because on the department detail view I set the cookie further down the code, so on the department detail view page itself the Nav Menu will not be customized.. 

    Hope it's not too confusing. So If I could read the module name + record ID in headerModuleList I could customize the Nav Bar right away without waiting to set the cookie.

  • I see, sorry, I've not looked at pre-sidecar Sugar in years and I'm afraid I can't help you here. Good luck.

  • Thank you André, I'll look into it!

  • thank you, I'll post an update if I figure it out

  • The file "themes/Sugar5/tpls/_headerModuleList.tpl" is called inside method "displayHeader" of class SugarView (the super class for views), so you would need to modify directally this method (BE CAREFULL!!!!) in order to fetch/assign the variables "$this->module" and "$this->bean->id" and finally edit that tpl file in order to render such tpl variables.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi André

    I modified displayHeader() as per your advice and definitely got further.

    But it's strange, no matter which module I open up it always shows the same module name: "Home" 

    app string is: ViewAjaxUI Object
    (
    [view_object_map] => Array
    (
    [remap_action] => ajaxui
    )

    [module] => Home
    [action] => ajaxui
    [bean] =>

    [ss] => Sugar_Smarty Object

    It's like it's completely disconnected from what's happening below the header.

    I echoed out the whole contents of the object instantiated from the SugarView class but there's no mention of the bean name and record id.

    Do you think there's something else I can try?

Reply
  • Hi André

    I modified displayHeader() as per your advice and definitely got further.

    But it's strange, no matter which module I open up it always shows the same module name: "Home" 

    app string is: ViewAjaxUI Object
    (
    [view_object_map] => Array
    (
    [remap_action] => ajaxui
    )

    [module] => Home
    [action] => ajaxui
    [bean] =>

    [ss] => Sugar_Smarty Object

    It's like it's completely disconnected from what's happening below the header.

    I echoed out the whole contents of the object instantiated from the SugarView class but there's no mention of the bean name and record id.

    Do you think there's something else I can try?

Children
No Data