How do you remove the active module from the main menu goups?

Hi,

I have configured Module Menu Filters.

However, the ‘current’ or ‘actively selected’ module is being added at the end of every menu group - and not being filtered out (as attached image)

How can I prevent this?

Thank you.

Hi, in Admin you also have the option “Display Modules and Subpanels” (above the module menu filters)

In the top list, you can drag the modules you want to hide from “Displayed Modules” to “Hidden Modules”

Thanks Jansiero,

That hides the module from all menu groups on my installation. I need to keep the module visible so that it can be selected.

For example…

Lets say I have ‘Office’ and ‘Project’ menu groups, and calender is filtered under the Office menu group.

After i select the Calender module, the Project menu group and all other menu groups are appended with a link to ‘Calendar’. If I then choose another menu item, that module is append to all the menu groups instead of the Calendar.

Were you able to find a fix for this? I, myself, am wanting to do the same thing in our instance as well. I do not like the fact that the active module selected shows up everywhere in the menu’s.

I will continue looking for a solution until then.

I have not found a fix yet, but will keep trying.

I have bigger fish to fry at the moment, but its these little annoyances that make a big difference to the user experience in my opinion.

I’m also curious about this as I haven’t been able to find a fix or other related threads.

I found where the code is that adds the menu item, but I am not sure how to modify it. It’s line 619-631 of the SugarView.php located in \include\MVC\View. This is a core file though so I definitely don’t want to modify it…

any suggestions?

I did find the source of the menu item. The code is located in lines 619-631 of SugarView.php located in \inlcude\MVC\View

The issue is that this is a core file and it’s obviously not a good idea to modify it directly. any suggestions on how this could be changed?

I found this solution/hack.
On /include/MVC/View/SugarView.php, change line 637

from:


$ss->assign("groupTabs",$groupTabs);

to:


// Customization: Remove current module from visible tabs
$visibleTabs = $groupTabs;
foreach($visibleTabs as $k => $v)
    unset($visibleTabs[$k]['modules'][$moduleTab]);
// End of Customiziation

Very hacking, but it works.

The correct code is the following. Sorry:


// Customization: Remove current module from visible tabs
$visibleTabs = $groupTabs;
foreach($visibleTabs as $k => $v)
    unset($visibleTabs[$k]['modules'][$moduleTab]);
$ss->assign("groupTabs",$visibleTabs);
// End of Customiziation

Thanks a.piazzesi.pqe!
I’ve implemented the code provided on our test server and it does prevent the currently selected module from appearing at the bottom of all navigation drop downs.

Note for others: It hides the selected module from the navigation entirely so say for example you have a Sales drop down with Leads, Opportunities, and Accounts. If you select Leads you will no longer see it in the Sales drop down until you select another module in your navigation.

I’m wondering if there’s a way to control this via /custom instead of directly in the includes but this will certainly work for me for now.

[edit]: it was actually around line 658 for us

Hi,
you can rewrite _headerModuleList.tpl inside the themes files.

For an old project, i have managed menù items from this file with javascript. It’s upgrade safe :wink:

or simply you can write a javascript function to hide the repeted active menù item. You have the module attribute of html tag of “currentTab” that is the same of the repeted tag a item to hide in the menù.

Could you give some more detailed explanation of what to modify in the headerModuleList.tpl file? This seems the safest way to accomplish the desired goal.

i think the easiest way is to write a javascript function to hide the repeated active items in the menù.
You can do this in the headermodulelist.tpl or in the js generic file custom/theme/SuiteP®/js/style.js

probably with jquery you can try something like :

var modulename = $(’.nav .currentTab a’).attr(‘module’);
$(’.nav .notCurrentTab a[module=’+modulename+’]’).super().hide();

not tested and probably with errors, but one possible way

The following worked for me:
*Note that it will also remove the “All” menu tab

In: /include/MVC/View

Comment/Remove this line (it is present twice):

$groupTabs[$app_strings[‘LBL_TABGROUP_ALL’]][‘modules’] = $fullModuleList;

I hope it helps :slight_smile:

IMPORTANT UPDATE: this will also break the menu links when the window is resized or in a mobile device

This thread is somewhat old, but I wanted to share my solution to this issue anyway.

My solution still creates a tab for the active module, but prevents the module from being appended to any other tab.

In /include/MVC/View/SugarView.php, edit line 654


if (!isset($topTabs[$moduleTab])) {

change it to


if (isset($extraTabs[$moduleTab])) {
1 Like

This is the right way.
You should comment some code lines in system file:
include/MVC/View/SugarView.php
Code lines:

if (!empty($moduleTab)) {
    $topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab];
    if (count($topTabs) >= $max_tabs - 1) {
        $extraTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab];
    }
}
1 Like

I suggest to create a config to change this behavior.

if (!empty($moduleTab)) {
  if (!isset($sugar_config['display_current_module_in_all_visible_group_tab']) ||
      $sugar_config['display_current_module_in_all_visible_group_tab']) {
     $topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab];
    if (count($topTabs) >= $max_tabs - 1) {
      $extraTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab];
    }
  }
}