<?php
$extensions["sports_list"] = array(
"section" => "sports_list",
"extdir" => "SportsList",
"file" => 'sportslist.ext.php',
"module" => "");
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.
The mechanism is slightly more complicated than merely copying a file to custom directory to override all its contents, but has advantages:
you can override just a part of what you’re modifying
different people can override different parts, without conflicts. For example, you can add a field to a layout, and then an add-on adds another, and a second add-on changes something else in the same layout. SuiteCRM will make sure all changes will be consolidated.
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 effect on performance of checking a (possibly large) number of files. This is only done when performing a repair and rebuild in the admin menu.
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 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 (the language extensions are treated specially and, as such, aren’t compiled to a single file) |
 |
Used to add, update or delete language strings for both modules and app strings. See the chapter on 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 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 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 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. |
To make sure certain customisations take precedence, there is an additional mechanism using files starting with _override
,
for example:
custom\Extension\modules\Accounts\Ext\Vardefs\_override_my_field_change.php
When Quick Repair & Rebuild is run, all the extension files are consolidated in two groups:
the 1st run gathers files not starting with _override
the 2nd run gathers files which start with _override
Since these files are loaded with a PHP require, the PHP in them is executed, and the overrides will be the last to run, so they will take effect regardless of what is done in the files read before.
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 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:
<?php
$extensions["sports_list"] = array(
"section" => "sports_list",
"extdir" => "SportsList",
"file" => 'sportslist.ext.php',
"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 its 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.
In order to add your own packages to Composer, you can define them in files named like this:
custom/Extension/application/Ext/Composer/*/*.json
An example could be
custom/Extension/application/Ext/Composer/MyProject/AddToComposer.json
Run a composer install --no-dev
after adding this, and then again after each time you upgrade SuiteCRM.
These Composer extensions are handled not by SuiteCRM directly, but rather by the Composer merge-plugin.
Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.