Hide topbuttons on subpanel with custom module

I want to hide the topbutton from a subpanel in my custom module. I know I have to add this logic in the:


It works perfectly. But I am still developing this module, so sometimes I have to implement/deploy my custom module again. After this the Layoutdefs folder will be deleted and generated again. So my custom file (to hide the topbutton) will be gone.

Is there a workaround/solution for this problem?

I assume you’re using Module Builder.

Because of this sort of issues, many people give up on Module Builder and just use Studio and editing PHP files directly.

Another approach is to use Module Builder initially, for the main work of setting up all the fields, but then dropping it in future evolutions of the design.

Yes, I’m using the Module Builder.

I created a module using the Module Builder and it works fine. But if I create a php file to override the subpanel and I will deploy the module again (after I change some other fields/layouts) then all this files in this folder will be gone.

So there is no workaround? the best option is to not use the Module Builder again and make my changes in the Studio?

Yes, that “deploy again” from Module Builder has this kind of limitation, it seems (I never used it). From Studio, it’s ok to deploy multiple times.