Let the platform do the work

Sidecar

Overview

The Sidecar extension installs metadata files to their appropriate directories.

Properties

The following extension properties are available. For more information, please refer to the Extension Property documentation.

Property Value
Extension Scope Module
Sugar Variable $viewdefs
Extension Directory ./custom/Extension/modules/<module>/Ext/clients/<client>/<type>/<subtype>/
Compiled Extension File ./custom/<module>/Ext/clients/<client>/<type>/<subtype>/<subtype>.ext.php
Manifest Installdef $installdefs['sidecar']

Implementation

The following sections illustrate the various ways to implement a customization to a Sugar instance.

File System

When working directly with the filesystem, you can create a file in ./custom/Extension/modules/<module>/Ext/clients/<client>/<type>/<subtype>/ to append the metadata extensions. The example below demonstrates how to add a new subpanel to a specific module:

./custom/Extension/modules/<module>/Ext/clients/base/layouts/subpanels/<file>.php

<?php

$viewdefs['<module>']['base']['layout']['subpanels']['components'][] = array(
    'layout' => 'subpanel',
    'label' => 'LBL_RELATIONSHIP_TITLE',
    'context' => array(
        'link' => '<link_name>',
    )
);

Next, navigate to Admin > Repair > Quick Repair and Rebuild. The system will then rebuild the extensions and compile your customization into ./custom/modules/<module>/Ext/clients/base/layouts/subpanels/subpanels.ext.php

Module Loadable Package

When building a module loadable package, you can use the $installdefs['sidecar'] index to install the metadata file.

Installdef Properties

Name Type Description
from String

The base path of the file to be installed

Note: When adding the file to a module loadable package, its 'from' path must be formatted as clients/<client>/<type>/<subtype>/<file>.php for Sugar to recognize the installation location.

to_module String
  • The key for the module where the file will be installed
  • If not populated, 'application' is used

The example below demonstrates the proper install definition that should be used in the ./manifest.php file in order to add the metadata file to a specific module. When using this approach, Sugar will automatically execute Rebuild Extensions and Metadata Rebuild to reflect your changes in the system.

./manifest.php

<?php

$manifest = array( 
    ... 
); 

$installdefs = array (
    'id' => 'sidecar_example',
    'sidecar' => array(
        array(
            'from' => '<basepath>/Files/custom/<module>/clients/base/layouts/subpanels/<file>.php',
            'to_module' => '<module>',
        ),
    ),
);

Alternatively, you may use the $installdefs['copy'] index to copy the file. When using this approach, you may need to manually run repair actions such as a Quick Repair and Rebuild. For more information on the $installdefs['copy'] index and module-loadable packages, please refer to the Introduction to the Manifest page.