Menu.php for Custom module build by module builder


When you build a package with module builder the original files are in custom/modulebuilder/packages/ and after the first build a built version sits in custom/modulebuilder/packages/

On SugarCRM it was possible to customise the Menu.php file in the build folder for future builds, but it seems that SuiteCRM overwrites the Menu.php in the build folder every time.

What is the best/correct way to customise Menu.php in a custom module in module builder?

(My current solution is to make Menu.php in the build folder immutable so it can not be overwritten, but that’s an ugly hack and difficult to maintain.)


Hi, welcome back - it’s been a long time since we saw you :tada:

I am afraid I don’t know much about Module Builder.

Do you know the place in the code where “SuiteCRM overwrites the Menu.php in the build folder every time”? We could try figuring out why that change was introduced, and perhaps create a better solution to whichever problem that was trying to solve…


I’ve tried to find it already, but could not.

Can you suggest any may to customise the menu in a custom module (inside the package)?

Have a look here, could this be it?

which then uses this file

Note that I am only doing quick searches, I don’t really understand this code, or even what you’re talking about - I really meant it when I said I don’t know much about Module Builder :man_shrugging:

Thank you!!

That seems to be it. I will change it not to overwrite an existing file and submit a patch.

1 Like

Cool. There was a bit of luck involved here. I’m used to tracking down code to answer “where is this coming from” questions, and sometimes it takes hours.

In this case, I went on a hunch and just searched the code for “createMenu”, and it was the first result :laughing:

Thank you!!

I kept searching in the Admin module - duh!

I have made it conditional on the file not existing in my dev instance which solves the issue for me.