In SugarCRM installable changes in detailview the question was asked about how to add a panel, using the Module Installer's manifest file to add to the the editview/detailview of an existing module without wiping out customizations previously made in the custom directory.
The answer was provided how to add fields, but not panels.
I know you could use a post_execute function called from the manifest file to edit the editviewdefs.php and detailviewdefs.php files in the /custom/modules//metadata/ directory, but that involves making some guesses about what already exists in those files.
Does anyone know how to add panels via the manifest file (or post_execute) that incrementally adds the panel, without using php code to manually edit the editviewdefs.php and detailviewdefs.php files?
Bingo - and Thank you to Matthew
I did not know where to find this and on the Sugar forum, no-one seemed to know so thank you Matthew.
So yes, it is very easy to add panels to an existing module in SugarCRM using the code that Matthew pointed out
To add a Panel called Events, in
/custom/modules/Accounts/language/en_us.lang.php
(add to this or create new file if you prefer)
add
and then in the post_install.php file in the /scripts directory of the install package put
(I have just put two existing fields in the new panel but you can just as easily place newly created fields (from the manifest file) into the new panel as well
You're after the ParserFactory class, which can be used from a post_install or similar script executed as your module/package is installed. My understanding is that ParserFactory will call custom files if they're there, or stock files and adjust them appropriately and safely if not.
In your module's directory, create a subdirectory called 'scripts' and create 'post_install.php' which contains a single function post_install(). Your package dir will look something like this:
You use the ParserFactory like this: