Let the platform do the work

Administration

Overview

The Administration extension adds new panels to Sugar's Administration page.

Properties

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

Property Value
Extension Scope Module: Administration
Sugar Variable $admin_group_header
Extension Directory ./custom/Extension/modules/Administration/Ext/Administration/
Compiled Extension File ./custom/modules/Administration/Ext/Administration/administration.ext.php
Manifest Installdef $installdefs['administration']

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/Administration/Ext/Administration/<file>.php to add new Administration Links in the system. The following example will add a new panel to the Administration page called "Example Admin Panel", which will contain one link called "Example Link":

The following example will create a new admin panel:

./custom/Extension/modules/Administration/Ext/Administration/<file>.php

    <?php

    $admin_option_defs = array();
    $admin_option_defs['Administration']['<section key>'] = array(
        //Icon name. Available icons are located in ./themes/default/images
        'Administration',

        //Link name label 
        'LBL_LINK_NAME',

        //Link description label
        'LBL_LINK_DESCRIPTION',

        //Link URL - For Sidecar modules
        'javascript:void(parent.SUGAR.App.router.navigate("<module>/<path>", {trigger: true}));',

        //Alternatively, if you are linking to BWC modules
        //'./index.php?module=<module>&action=<action>',
    );

    $admin_group_header[] = array(
        //Section header label
        'LBL_SECTION_HEADER',

        //$other_text parameter for get_form_header()
        '',

        //$show_help parameter for get_form_header()
        false,

        //Section links
        $admin_option_defs, 

        //Section description label
        'LBL_SECTION_DESCRIPTION'
    );

Next, we will populate the panel label values:

./custom/Extension/modules/Administration/Ext/Language/en_us.<name>.php

    <?php

    $mod_strings['LBL_LINK_NAME'] = 'Example Link';
    $mod_strings['LBL_LINK_DESCRIPTION'] = 'Link Description';
    $mod_strings['LBL_SECTION_HEADER'] = 'Example Admin Panel';
    $mod_strings['LBL_SECTION_DESCRIPTION'] = 'Section Description';

Next, navigate to Admin > Repair > Quick Repair and Rebuild. The system will then rebuild the extensions, compiling your customization into ./custom/modules/Administration/Ext/Administration/administration.ext.php, and the new panel will appear in the Administration section.

Module Loadable Package

When building a module loadable package, use the $installdefs['administration'] index to install the extension file.

Installdef Properties

Name Type Description
from String The base path of the file to be installed

The example below demonstrates the proper install definition that should be used in the ./manifest.php file in order to add the Administration file to the system. If you are utilizing a Language file, as recommended above, you must use the $installdefs['language'] index to install the Language definition. Using the $installdefs['administration'] index will automatically execute Rebuild Extensions to reflect the new Administration Links in the system.

    <?php

$manifest = array(
    ...
);

$installdefs = array(
    'id' => 'administration_example',
    'administration' => array(
        array(
           'from' => '<basepath>/custom/Extension/modules/Administration/Ext/Administration/<file>.php'
        )
    ),
    'language' => array(
        array(
            'from' => '<basepath>/custom/Extensions/modules/Administration/Ext/Language/en_us.<file>.php',
            'to_module' => 'Administration',
            'language' =>'en_us'
        )
    )
); 

Alternatively, you may also choose to use the $installdefs['copy'] index for the Administration Link Extension file. When using this approach, you may need to manually run a repair action 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.

Topics