How is the process to remove a subpanel ?
How is the process to remove a subpanel ?
You can use the "Display Modules and Subpanels" in the Developer section of the Admin Page.
I have found this url https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.1/Cookbook/Dynamically_Hiding_Subpanels_Based_on_Record_Values/ but is there any thing regards to php??
After I did this change does not apply to Mobile
Rodrigo Manara
Sr. Developer
This cookbook applies to only js controllers. There is no way to, dynamically, hide subpanels through php.
Also mobile is not affect by those changes once it doesn't download js controllers from Sugar server.
It is possible to dynamically hide subpanels on mobile but it requires compiling a custom mobile app from sugar-mobile-sdk, which is only possible from either Apple computers or Docker container under Linux.
the way I have manage to do this is following "https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/389/hide-contacts-subpanel-in-accounts-module" but it does not apply to on Demand
Rodrigo Manara
Sr. Developer
Hi, Rodrigo.
You can try this one to include in custom js file:
(function appFunc(app) {
app.events.on("app:start", function appStartFunc() {
if (!app.view.layouts.BaseSubpanelsLayout && !app.view.layouts.BaseCustomSubpanelsLayout) {
app.view.declareComponent("layout", "subpanels", undefined, undefined, false, "base");
}
var subpanelsLayout = "BaseSubpanelsLayout";
if (app.view.layouts.BaseCustomSubpanelsLayout) {
subpanelsLayout = "BaseCustomSubpanelsLayout";
}
if (App.view.layouts[subpanelsLayout].hideIMSubpanel === true) {
return;
}
App.view.layouts[subpanelsLayout] = App.view.layouts[subpanelsLayout].extend({
hideIMSubpanel: true,
_hiddenSubpanels: [],
initialize: function () {
var result = this._super("initialize", arguments);
if (this.model.module === "ModuleNAmeisHere") {
app.api.call("read", "rest/v10/ModuleNAmeisHere/" + this.model.id + "?fields=name", null, {
success: function apiCallSuccess(model) {
this._hideUnnecessarySubpanel("subpanelrelationship Link or table");
}.bind(this)
});
}
return result;
},
/**
* Add to the _hiddenSubpanels array, and hide the subpanel
*/
_hideUnnecessarySubpanel: function (link) {
this._hiddenSubpanels.push(link);
var component = this._getSubpanelByLink(link);
if (!_.isUndefined(component)) {
component.hide();
}
this._hiddenSubpanels = _.unique(this._hiddenSubpanels);
},
/**
* Helper for getting the Subpanel View for a specific link
*/
_getSubpanelByLink: function (link) {
return this._components.find(function findComponent(component) {
return component.context.get("link") === link;
});
},
});
});
})(SUGAR.App);
laxmichand
thanks , but my issue now is with mobile, as it does not apply to mobile only desktop
Rodrigo Manara
Sr. Developer
Hi Rodrigo Manara,
Mobile uses a different layout than the base layout - so you'll have to edit the mobile layout for the module in which you want to hide the subpanel. To "always" hide a subpanel in mobile, you can edit the following file (to keep things simple for now):
custom/modules/Accounts/clients/mobile/layouts/subpanels/subpanels.php
Note that the layout folder is different - clients/mobile layout.
The subpanels.php file defines which subpanels are displayed. If this file is not present, copy it from the main modules folder. Modify this file as needed, comment/uncomment the section that you don't want and then do a Quick Repair/Rebuild. This will hide the subpanel only in mobile layout.
There are also other ways to hide a subpanel using php config, and you know how to do that based on the links that you shared already.
Also, this method I don't think there is an easy way to "conditionally" hide subpanels in mobile, as Andre mentioned. This solution is only to "always" hide a subpanel.
Please let me know if this helps!