Search code examples
sugarcrmsuitecrm

Remove Module Lists in SugarCRM Custom Module


I want to remove the Modules Tab (module list and sub-module list) from my custom module.

I have tried some solutions but in vain. e-g:

options['show_header'] = false; 

It removes all header but I want to remove Logo and Global Links.

Disable all modules and change "tab=>false" in manifest.php file of custom module.


Solution

  • There's not an official way to do this through the configuration or anything, but you could use a custom logic hook for this to inject some javascript to hide the module list.

    Say your custom module is abc_CustomModule, create a logic_hooks.php or add to it if it doesn't exist custom/modules/abc_CustomModule/logic_hooks.php

    <?php
    
    $hook_version = 1; 
    $hook_array = Array(); 
    $hook_array['after_ui_frame'] = Array(); 
    $hook_array['after_ui_frame'][] = Array(1, 'Hide Modules', 'custom/modules/abc_CustomModule/abc_CustomModule_custom.php','abc_CustomModule_custom', 'hide_modules'); 
    

    At the end of each page load for your custom module, it'll run the following code in custom/modules/abc_CustomModule/abc_CustomModule_custom.php

    <?php
    
    class abc_CustomModule_custom
    {
        function hide_modules($bean, $event)
        {
            echo "<script>$('#ajaxHeader').hide()</script>";
        }
    }
    

    This simply outputs some javascript that will hide the div that contains the modules.