AnsweredAssumed Answered

Is it possible to extend a Subpanel Layout on a global level in Sugar 7?

Question asked by EvilPeri EvilPeri on Feb 19, 2014
Latest reply on Mar 12, 2014 by EvilPeri EvilPeri
so i was tasked to customize the subpanel layout for a module. 
i created a file on custom/modules/<my module>/client/base/layout/subpanel/subpanel.js and also the php file.


so i created something like this:

({
   extendsFrom: 'SubpanelLayout',
   initialize: function(opts){
        this._super('initialize',[opts]);
        this.doSomethingAwesome(opts);
   },
   doSomethingAwesome(opts){
     //why you no do cool stuff
   }
})

turns out that multiple modules would need this customization. So i moved the customization to custom/client/base/layout/subpanel/subpanels.js with the same code inside.

First thing i noticed after a rebuild and repair was the panel-top of each subpanel was broken. After a few hours of debugging (and raging ( really i mean it like pulling my hair and was about to gouge my eyes out)) turns out that in the panel layout initialize method has a listenTo action and well the "this" in inside that listenTo was undefined. After a few more debugging it turns out that you need to copy the entire subpanel layout to the custom/client folder. 

Now comes my question, is there a way to implement this? not on a modular level but globally without the need to copy the entire subpanel layout

Thanks in advance

Outcomes