The purpose of the extension framework is to provide the installable modules with capability to modify Sugar metadata – like vardefs, layout, etc. (actually many more, see below) in a safe way that supports installing, uninstalling, disabling and enabling modules and lets all modules play along without interfering with each other.
How it works
Each extension point has its own directory under custom/Extension/application/Ext and custom/Extension/modules/Module/Ext. Modules can deploy files there, then these files are aggregated and put in a single file with predefined name (like vardef.ext.php) in custom/application/Ext and custom/modules/Module/Ext under the same directory name. So, for example, for vardefs, all files in custom/Extension/application/Ext/Vardefs are merged into custom/application/Ext/Vardefs/vardefs.ext.php and all files from custom/Extension/modules/Accounts/Ext/Vardefs are merged into custom/modules/Accounts/Ext/Vardefs/vardefs.ext.php. This file will be loaded by the part of SugarCRM that updates vardefs. This happens every time module is installed, uninstalled, enabled or disabled, and also when Repair & Rebuild is run.
What can be changed
The extension points are listed at ModuleInstaller/extensions.php. Please note that this file does not define what the data in each of the files does – it just defines which files will be merged on rebuild and where the result goes, that’s all.
|Name||Installdefs section||Ext Name||Ext file||Usage|
|Internal name of the extension, used in method names such as rebuild_leyouts||Section name in the manifest file||Name of the subdirectory in the Ext/ directory||Name of the file where Ext/ data is assembled||Places where this extension is used|
|actionviewmap||action_view_map||ActionViewMap||action_view_map.ext.php||SugarController action->view mapping|
|actionfilemap||action_file_map||ActionFileMap||action_file_map.ext.php||SugarController action->file to load mapping|
|actionremap||action_remap||ActionReMap||action_remap.ext.php||SugarController action rewriting|
|administration||administration||Administration||administration.ext.php||Administration module – what is displayed on Admin page|
|entrypoints||entrypoints||EntryPointRegistry||entry_point_registry.ext.php||SugarController – list of direct entry points|
|extensions||extensions||Extensions||extensions.ext.php||ModuleInstaller extensions list|
|file_access||file_access||FileAccessControlMap||file_access_control_map.ext.php||SugarController – file access control|
|languages||language||Languages||LANG.lang.ext.php||Language strings – used everywhere. LANG is language like en_us.|
|layoutdefs||layoutdefs||Layoutdefs||layoutdefs.ext.php||Module layouts & subpanels|
|links||linkdefs||GlobalLinks||links.ext.php||Top links bar|
|logichooks||hookdefs||LogicHooks||logichooks.ext.php||Logic hooks (LogicHooks.php)|
|schedulers||scheduledefs||ScheduledTasks||scheduledtasks.ext.php||Scheduler (instead of AddJobsHere.php)|
|utils||utils||Utils||custom_utils.ext.php||include/utils.php – additional utility stuff to include|
|vardefs||vardefs||Vardefs||vardefs.ext.php||Module field definitions|
|wireless_modules||wireless_modules||WirelessModuleRegistry||wireless_module_registry.ext.php||SugarController – modules for wireless clients|
How to extend
You can add your own types of extensions by using “Extensions” point – i.e., just add your own entry along with those already defined in ModuleInstaller/extensions.php and it will be included in the general process of the merge. The data format is like this:
"name" => array( "section" => "section", "extdir" => "Extname", "file" => 'file.ext.php', "module" => "Module" )
name – is the name of the extension point, important if ModuleInstaller has specific hooks to handle it, but otherwise just for identification
section – the section in module’s installdefs where files for this extension point are supposed to be listed (e.g., layoutdefs)
extdir – extension point directory, as above, e.g. Vardefs or Layoudefs. Files mentioned in the section above will be copied to this directory for this extensionfile – name of the merge file. This is what the SugarCRM application code will be including to see all the data.
module – optional, can be “application” or module name like “Administration” or “Users”. Specifies that the extension point is relevant only for specific module, such as userpage point which works only for Users module.
You can have your own code to use the extension file generated by the framework and thus define your own extension point which other modules will be able to use.