Those of you that read my previous article describing the process for dynamically hiding subpanels may have been left wondering something about the instructions. Reading the article we find that the specific bit of code that hides the subpanel reads as follows:
unset($layout_defs['Accounts']['subpanel_setup']['opportunities']);
In the above, the subpanel for Opportunities data on the Accounts module is being suppressed. But how does one come about knowing the name of the array to manipulate? Further to this, where did the value of 'opportunities' come from? What are the rules for the other panels?
Fortunately, the answers to those questions are all found in one file: subpaneldefs.php
This file can be found in <sugar_root>/modules/<module>/metadata. For our referenced example, suppressing the Opportunities subpanel on Accounts records, the corresponding subpaneldefs.php file that contains our answers is located in <sugar_root>/modules/Accounts/metadata.
Said file will contain a listing of all the defined subpanels for the Accounts module, along with various parameters that are used to display them. To manipulate the elements, create a layoutdefs.ext.php file, as with suppressing the subpanel, focusing on the specific elements of the array that you wish to change.
Don't forget to run a Quick Rebuild and Repair to apply any changes you wish to introduce via layoutdefs.ext.php.
No comments:
Post a Comment
Your comments, feedback and suggestions are welcome, but please refrain from using offensive language and/or berating others. Thank you in advance.