Chapter 14

## 14. Extension Framework ## ### Introduction ### The extension framework provides a means to modify various application data inside SuiteCRM. For example it provides a way to add or modify vardefs, scheduled tasks, language strings and more. In general a folder is provided in custom/Extension (the exact path depends on the extension). This folder is then scanned for files which will be consolidated into a single ext file which SuiteCRM will then read and use. In this way it is possible for developers to add a new file to affect the behaviour of SuiteCRM rather than altering existing files. This makes the changes more modular and allows the easy addition or removal of changes. Additionally, because these files are all consolidated it means that there is no affect on performance of checking a (possibly large) number of files. This is only done when performing a repair and rebuild in the admin menu. ### Standard Extensions ### List of standard SuiteCRM extensions {| ! Extension Directory ! Compiled file ! Module ! Description |- | ActionViewMap | action_view_map.ext.php |   | Used to map actions for a module to a specified view. |- | ActionFileMap | action_file_map.ext.php |   | Used to map actions for a module to a specified file. |- | ActionReMap | action_remap.ext.php |   | Used to map actions for a module to existing actions. |- | Administration | administration.ext.php | Administration | Used to add new sections to the administration panel. |- | EntryPointRegistry | entry_point_registry.ext.php | application | Used to add new entry points to SuiteCRM. See the chapter on [[#chap07.xhtml#entry-point-chapter|Entry Points]]. |- | Extensions | extensions.ext.php | application | Used to add new extension types. |- | FileAccessControlMap | file_access_control_map.ext.php |   | Used to add, update or delete entries in the access control lists for files. |- | Language | N/A[[#chap13.xhtml#fn-langNote|1]] |   | Used to add, update or delete language strings for both modules and app strings. See the chapter on [[#chap08.xhtml#language-chapter|Language Strings]]. |- | Layoutdefs | layoutdefs.ext.php |   | Used to add, update or delete subpanel definitions for a module. |- | GlobalLinks | links.ext.php | application | Used to add, update or delete global links (the list of links that appear in the top right of the SuiteCRM UI). |- | LogicHooks | logichooks.ext.php |   | Used to add, update or delete logic hooks. See the chapter on [[#chap11.xhtml#logic-hooks-chapter|Logic Hooks]]. |- | Include | modules.ext.php | application | Used to register new beans and modules. |- | Menus | menu.ext.php |   | Used to add, update or delete the menu links for each module. |- | ScheduledTasks | scheduledtasks.ext.php | Schedulers | Used to add new scheduled tasks. See the chapter on [[#chap12.xhtml#scheduled-tasks-chapter|Scheduled Tasks]]. |- | UserPage | userpage.ext.php | Users | Unused |- | Utils | custom_utils.ext.php | application | Used to add new utility methods. |- | Vardefs | vardefs.ext.php |   | Used to add, update or delete vardefs for a module. See the section on [[#chap03.xhtml#vardefs-chapter|Vardefs]]. |- | JSGroupings | jsgroups.ext.php |   | Used to add, update or delete JavaScript groupings. |- | Actions | actions.ext.php | AOW_Actions | Used to add new WorkFlow actions. |} ### Custom Extensions ### Interestingly the extension framework can be used to add new extensions. This allows you to create customisations that are easily customised by others (in a similar manner to, for example, how vardefs can be added - see the chapter on [[#chap03.xhtml#vardefs-chapter|Vardefs]]). To create a custom extension you simply add a new file in
custom/Extension/application/Ext/Extensions. This can be given a name of your choosing. Our example will use
custom/Extension/application/Ext/Extensions/SportsList.php and will look like:
Example 14.1: Adding an entry point entry -----
1 <?php
2 $extensions["sports_list"] =  array(
3                 "section" => "sports_list",
4                 "extdir" => "SportsList",
5                 "file" => 'sportslist.ext.php',
6                 "module" => "");
-----
Now when a Quick Repair and rebuild is run any files in
custom/Extension/application/Ext/SportsList/ will be consolidated into
custom/application/Ext/SportsList/sportslist.ext.php. On it’s own this file will not do anything but you are now able to write custom code that checks the consolidated file rather than having to worry about searching for customisations.