Overview
The Module Loader relies on a file named manifest.php, which resides in the root directory of any installable package.
Manifest Definitions
The following section outlines the parameters specified in the $manifest array contained in the manifest file (manifest.php).
$manifest array elements provide the Module Loader with descriptive information about the extension.
name
The name of the package. This is displayed in the module loader.
Example:
'name' => 'Example Package',
description
A description of the package. This is displayed in the module loader.
Example:
'description' => 'Example Package Description',
version
The version of the package, i.e. “1.0”. This is displayed in the module loader.
Example:
'version' => '1.0',
author
Contains the author of the package, i.e. “SugarCRM”
Example:
'author' => 'SugarCRM',
readme
A path (within the package ZIP file) to a readme document that will be displayed during installation.
acceptable_sugar_flavors
Specifies which Sugar Editions the package can be installed on.
Accepted values are:
- CE
- PRO
- CORP
- ENT
- ULT
Example:
'acceptable_sugar_flavors' => array( 'CE', 'PRO', 'CORP', 'ENT', 'ULT'),
acceptable_sugar_versions
exact_matches
each element in this array should be one exact version string, i.e. “6.4.5” or “6.5.0”
regex_matches
each element in this array should be one regular expression designed to match a group of versions, i.e. “6.4.[0-1]$"
Example:
'acceptable_sugar_versions' => array( 'exact_matches' => array( '6.4.0', '6.4.1', ), //or 'regex_matches' => array( '6\\.4\\.[0-1]$', ),),
copy_files
An array detailing the source and destination of files that should be copied during installation of an upgrade package. Please note that this attribute is only for packages of type ‘patch’ that are installed through the upgrade wizard. If you are looking to move files into an instance using the module loader you should use the ‘copy’ attribute in the $installdefs.
from_dir
Used to specify the directory inside the archive from which to copy files from
to_dir
Used to specify the destination directory inside of SugarCRM. Leaving this empty will copy the files and folders located in the from_dir path to SugarCRM’s root directory.
force_copy
Used to specify file names that will be forcefully copied over during an upgrade patch. This array is normally empty.
Example:
'copy_files' => array ( 'from_dir' => '<basepath>/custom/', 'to_dir' => 'custom', 'force_copy' => array (),),
dependencies
id_name
The unique name found in $installdefs.
version
The version number.
icon
A path (within the package ZIP file) to an icon image that will be displayed during installation. Examples include: "./patch_directory/icon.gif" and "./patch_directory/images/theme.gif"
is_uninstallable
Setting this directive to TRUE allows the Sugar administrator to uninstall the package. Setting this directive to FALSE disables the uninstall feature.
Example:
'is_uninstallable' => true,
published_date
The date the package was published.
Example:
'published_date' => '2012-07-06 21:01:59',
type
The package type. Accepted values are:
langpack
Packages of type langpack will be automatically added to the “Language” dropdown on the Sugar Login screen. They are installed using the Upgrade Wizard.
Example:
'type' => 'langpack',
module
Packages of type module are installed using the Module Loader.
Example:
'type' => 'module',
patch
Packages of type patch are installed using the Upgrade Wizard.
Example:
'type' => 'patch',
theme
Packages of type theme will be automatically added to the “Theme” dropdown on the Sugar Login screen. They are installed using the Upgrade Wizard.
Example:
'type' => 'theme',
Installdef Definitions
The following section outlines the parameters specified in the $installdef array contained in the manifest file (manifest.php).
$installdef array elements are used by the Module Loader to determine the actual installation steps that need to be taken to install the extension.
id
A unique name for your module.
Example:
'id' => 'package_1343150321',
connectors
An array detailing files to be copied to the ./custom/modules/Connectors/connectors/ directory as a connector. The path for the connector is determined from the connector ‘name’ index in the installdefs. With an example name of ext_rest_example, the sources will be installed to ./custom/modules/Connectors/connectors/sources/ext/rest/example/ and the formatters to ./custom/modules/Connectors/connectors/formatters/ext/rest/example/.
name
The class name of the connector. This will also determine the path to install the connector under.
connector
The path to the folder inside of the zip package for the connector files.
formatter
The path to the folder inside of the zip for the formatter files.
'connectors' => array( array( 'name' => 'ext_rest_example', 'connector' => '<basepath>/example/source', 'formatter' => '<basepath>/example/formatter', ),),
copy
An array detailing files to be copied to the Sugar directory. A source path and destination path must be specified for each file or directory.
Example:
Example:
'copy' => array( 0 => array( 'from' => '<basepath>/Files/custom/modules/Accounts/accounts_save.php', 'to' => 'custom/modules/Accounts/accounts_save.php', ),),
dashlets
An array detailing files to be copied to the ./custom/modules/Home/Dashlets/ directory. A dashlet name and pack install from path must be specified for each dashlet.
name
The name to install the dashlet under.
from
The directory that contains the dashlet files in the package.
Example:
'dashlets' => array( 0 => array( 'name' => 'MyDashlet', 'from' => '<basepath>/MyDashlet', ),),
language
An array detailing individual language files for your module. The source path, destination file, and language pack name must be specified for each language file.
Example:
'language'=> array ( array( 'from' => '<basepath>/files/Language/Accounts/en_us.lang.php', 'to_module' => 'Accounts', 'language' => 'en_us' ),),
layoutdefs
An array detailing individual layoutdef files, which are used primarily for setting up subpanels in other modules. The source path and destination module must be specified for each layoutdef file.
layoutfields
An array detailing custom fields to be added to existing layouts. The fields will be added to the edit and detail views of target modules.
vardefs
An array detailing individual vardef files, which are used primarily for defining fields and non many-to-many relationships in other modules. The source path and destination module must be specified for each vardef file.
menu
An array detailing the menu file for your new module. A source path and destination module must be specified for each menu file. See the example manifest file below for details.
beans
An array specifying the bean files for your new module. The following sub-directives must be specified for each bean:
module
Your module’s name, “Songs”
class
Your module’s primary class name, “Song”
path
The path to your bean file where the above class is defined.
tab
Controls whether or not your new module appears as a tab.
relationships
An array detailing relationship files, used to link your new modules to existing modules. A metadata path must be specified for each relationship. See the example manifest file below for details.
custom_fields
An array detailing custom fields to be installed for your new module. The following sub-directives must be specified for each custom field:
name
The internal name of your custom field. Note that your custom field will be referred to as <name>_c, as “_c” indicates a custom field.
label
The visible label of your custom field
type
The type of custom field. Accepted values include text, textarea, double, float, int, date, bool, enum, and relate.
max_size
The custom field’s maximum character storage size.
require_option
Used to mark custom fields are either required or option. Accepted values include optional and required.
default_value
Used to specify a default value for your custom field.
ext1
Used to specify a dropdown name (only applicable to enum type custom fields).
ext2
Unused.
ext3
Unused.
audited
Used to denote whether or not the custom field should be audited. Accepted values include 0 and 1.
module
Used to specify the module where the custom field will be added.
Example:
'custom_fields' => array ( array ( 'name' => 'text_c', 'label' => 'LBL_TEXT_C', 'type' => 'varchar', 'max_size' => 255, 'require_option' => 'optional', 'default_value' => '', 'ext1' => '', 'ext2' => '', 'ext3' => '', 'audited' => 1, 'module' => 'Accounts', ),),
logic_hooks
An array detailing logic hooks to be installed to the system. The following sub-directives must be specified for each logic hook:
module
Used to specify the module where the logic hook will be added.
hook
Used to specify the logic hook type. Valid types are:
Application Hooks
- after_ui_frame
- after_ui_footer
- server_round_trip
Module Hooks
- after_delete
- after_relationship_add
- after_relationship_delete
- after_restore
- after_retrieve
- after_save
- before_delete
- before_restore
- before_save
- process_record
Job Queue Hooks
- job_failure
- job_failure_retry
User Hooks
- after_load_user
- after_login
- after_logout
- before_logout
- login_failed
order
Used to specify the logic hook execution order.
description
Used to describe the logic hook.
file
Used to specify the file containing the logic hook.
class
Used to specify the class of the logic hook function you would like to execute.
function
Used to specify the logic hook function you would like to execute.
Example:
'logic_hooks' => array( array( 'module' => 'Accounts', 'hook' => 'before_save', 'order' => 99, 'description' => 'Set Account Name', 'file' => 'custom/modules/Accounts/Accounts_Save.php', 'class' => 'Accounts_Save', 'function' => 'SetAccountName', ),),
pre_execute
Used to execute logic from a file (or set of files) before a package is installed. Anything printed to the screen in the script will be displayed when clicking on the ‘Display Log’ link.
Example:
In manifest.php
'pre_execute' => array( 0 => '<basepath>/pre_execute.php',),
In <installer package>/pre_execute.php
<?php //pre_execute logic echo 'pre_execute script<br>'; ?>
post_execute
Used to execute logic from a file (or set of files) after a package is installed. Anything printed to the screen in the script will be displayed when clicking on the ‘Display Log’ link.
Example:
'post_execute' => array( 0 => '<basepath>/post_execute.php',),
In <installer package>/post_execute.php
<?php //post_execute logic echo 'post_execute script<br>'; ?>
pre_uninstall
Used to execute logic from a file (or set of files) before a package is uninstalled. Anything printed to the screen in the script will be displayed when clicking on the ‘Display Log’ link.
Example:
'pre_uninstall' => array( 0 => '<basepath>/pre_uninstall.php',),
In <installer package>/pre_uninstall.php
<?php //pre_uninstall logic echo 'pre_uninstall script<br>'; ?>
post_uninstall
Used to execute logic from a file (or set of files) after a package is uninstalled. Anything printed to the screen in the script will be displayed when clicking on the ‘Display Log’ link.
Example:
'post_uninstall' => array( 0 => '<basepath>/post_uninstall.php',),
In <installer package>/post_uninstall.php
<?php //post_uninstall logic echo 'post_uninstall script<br>'; ?>