What’s new in Sugar 6.3: Ext framework enhancements

bsoremsugar —  November 23, 2011 — 17 Comments

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
dependencies dependencies Dependencies deps.ext.php SugarLogic calculations
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)
menus menu Menus menu.ext.php Module menus
modules beans Include modules.ext.php Custom beans
schedulers scheduledefs ScheduledTasks scheduledtasks.ext.php Scheduler (instead of AddJobsHere.php)
userpage user_page UserPage userpage.ext.php User module
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"
    )

Where:

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.

17 responses to What’s new in Sugar 6.3: Ext framework enhancements

  1. 

    amazing tutorial

  2. 

    So, to “add your own types of extensions” we would have to modify core “ModuleInstaller/extensions.php” file?

  3. 

    I’m trying to extend languages in the custom folder because I just want to add a specific label for my custom project dashlet.  Below is my installdef but it has an error copying the file when I try to install my package.  I’ve installed packages before so I don’t think I’m missing anything there.  Is this the proper way to extend in this situation?

    This is my en_us.ARX_MyProjectLabel.php  file
    $mod_strings['LBL_LIST_MY_PROJECT'] = ‘Project’;$installdefs = array( ‘id’=> ‘MyProjectLabel’,’mkdir’ => array(     array(‘path’ => ‘/custom/Extension/modules/Project/Ext/Language’),    ),  ‘copy’ => array(     array(      ‘from’ => ‘/MyProjectLabel/en_us.ARX_MyProjectLabel.php’,      ‘to’   => ‘/custom/Extension/modules/Project/Ext/Language/en_us.ARX_MyProjectLabel.php’,     ),    ), );

  4. 
    Apoorva Dhanvanthri September 4, 2012 at 2:23 am

    How to schedule a job in the schedulers through this

Trackbacks and Pingbacks:

  1. Best way to add scheduler jobs through module loader without overwriting previous job - April 9, 2012

    [...] [...]

  2. Not getting scheduler to work - May 17, 2012

    [...] [...]

  3. custom/Extenstion and custom/application/Ext <------- can someone explain these - June 5, 2012

    [...] [...]

  4. SugarCRM Developer Blog » Blog Archive » Use the new Job Queue to make logic hooks perform faster - September 12, 2012

    [...] NOTE: Updated to remove before mentioned hack for making job class available, now you can do this via the Ext Framework [...]

  5. SugarCRM Developer Blog » Blog Archive » Adding your own recurring jobs to the Scheduler - September 12, 2012

    [...] can use the Ext framework for this. Simply define a job in a file named MyCustomJob.php in the [...]

  6. HOW TO: Cleaning add a custom entry point - September 13, 2012

    [...] [...]

  7. Allowing Access To Parts Of Sugar Without Logging In - September 13, 2012

    [...] [...]

  8. SugarCRM Developer Blog » Blog Archive » Include additional libaries in an upgrade-safe way - September 26, 2012

    [...] it in an upgrade-safe way. However, this isn’t all that preferred as a method, and using the Ext framework is the much better way to [...]

  9. SugarCRM Developer Blog » Blog Archive » Customizing the query used for a subpanel - October 8, 2012

    [...] comes the function itself, which thanks to the Ext Framework can be dropped in any .php file in the custom/Extension/application/Ext/Utils/ directory. Note the [...]

  10. SugarCRM: Customize Web To Lead Capture via Ext Framework | Antonio Musarra's Blog - March 21, 2013

    [...] Per maggiori informazioni sull’Ext Framework consiglio di consultare la documentazione di SugarCRM ma in particolare questo post What’s new in Sugar 6.3: Ext framework enhancements. [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s