HOWTO: Add your own admin panels

sugarcrmdevelopers —  July 15, 2011 — 10 Comments

Many of you who develop modules on SugarForge or for your own Sugar instance often find the need to add in administration functionality for it. This maybe use to control features or functionality of the module, or perhaps define some defaults that are used in the module. Fortunately, the ability to add these panels as a part of the existing admin section is a very easy and upgrade-safe task.

You can define new admin items in the custom/Extension/modules/Administration/Ext/Administration/ directory, creating a new .php file in that directory to hold the admin items. There are two parts to defining this; in the first part we will define the actual admin panels we will be adding.

$admin_options_defs=array();
$admin_options_defs['MODULENAME']['ADMINPANEL1']=array(       
        'MODULENAME',
        'LBL_ADMINPANEL1_TITLE',
        'LBL_ADMINPANEL1_DESC',
        './index.php?module=MODULENAME&action=ADMINPANEL1VIEW'
        );
$admin_options_defs['MODULENAME']['ADMINPANEL2']=array(       
        'MODULENAME',
        'LBL_ADMINPANEL2_TITLE',
        'LBL_ADMINPANEL2_DESC',
        './index.php?module=MODULENAME&action=ADMINPANEL2VIEW'
        );

Substitute MODULENAME for the name of your module above, and the various ADMINPANEL* shortcuts for the name of the panel your will be adding. Next, we will take this list of menu options an put them in a group.

$admin_group_header[]=array(
    'LBL_ADMINPANELGROUP_TITLE',
    '',
    false,
    $admin_options_defs,
);

After a Quick Rebuild and Repair, the new admin options will show up at the bottom of the Admin section in a new panel.

10 responses to HOWTO: Add your own admin panels

  1. 

    Is there any more information on custom admin areas? I have added the above but don’t really know what to do next.
    Any help would be appreciated

    • 

      Did you do a Quick Rebuild and Repair? With that the option should be present.

    • 

      the modification described here adds link in the admin panel to address like: index.php?module=MODULENAME&action=ADMINPANEL1

      you can add file in sugar path like modules/MODULENAME/ADMINPANEL1.php (or .html) to set the actual content of those pages

  2. 

    how do i make a menu open a new tab?

  3. 
    Francis Derequito May 21, 2013 at 8:39 pm

    Good morning Everyone, I was wondering if where to find the panels code that gets to be displayed when I click Admin link.. the one that says:
    LBL_ASOL_WFM_PANEL

    because I want to remove that panel but I don’t know where to find it’s source … *help Newbie 🙂

  4. 

    Thanks

  5. 

    John,

    I’ve followed the approach above, but am having problems adding Admin links to SugarOnDemand (currently Version 6.7.2 (Build 1118)). In regards to these admin seciotn/links, are there any differences between versions such as CE and SugarOnDemand? Admin links are not showing up on SugarOnDemand. It works perfectly on CE.

    Here’s the def. Any ideas why they are not appearing?

    $admin_option_defs = array();

    $admin_option_defs[‘jjwg_Maps’][‘config’] = array(
    ‘Administration’,
    ‘LBL_JJWG_MAPS_ADMIN_CONFIG_TITLE’,
    ‘LBL_JJWG_MAPS_ADMIN_CONFIG_DESC’,
    ‘./index.php?module=jjwg_Maps&action=config’
    );

    $admin_option_defs[‘jjwg_Maps’][‘geocoded_counts’] = array(
    ‘Contacts’,
    ‘LBL_JJWG_MAPS_ADMIN_GEOCODED_COUNTS_TITLE’,
    ‘LBL_JJWG_MAPS_ADMIN_GEOCODED_COUNTS_DESC’,
    ‘./index.php?module=jjwg_Maps&action=geocoded_counts’
    );

    $admin_option_defs[‘jjwg_Maps’][‘geocoding_test’] = array(
    ‘CreateContacts’,
    ‘LBL_JJWG_MAPS_ADMIN_GEOCODING_TEST_TITLE’,
    ‘LBL_JJWG_MAPS_ADMIN_GEOCODING_TEST_DESC’,
    ‘./index.php?module=jjwg_Maps&action=geocoding_test’
    );

    $admin_option_defs[‘jjwg_Maps’][‘geocode_addresses’] = array(
    ‘CreateContacts’,
    ‘LBL_JJWG_MAPS_ADMIN_GEOCODE_ADDRESSES_TITLE’,
    ‘LBL_JJWG_MAPS_ADMIN_GEOCODE_ADDRESSES_DESC’,
    ‘./index.php?module=jjwg_Maps&action=geocode_addresses’
    );

    $admin_option_defs[‘jjwg_Maps’][‘donate’] = array(
    ‘Opportunities’,
    ‘LBL_JJWG_MAPS_ADMIN_DONATE_TITLE’,
    ‘LBL_JJWG_MAPS_ADMIN_DONATE_DESC’,
    ‘./index.php?module=jjwg_Maps&action=donate’
    );

    $admin_option_defs[‘jjwg_Maps’][‘address_cache’] = array(
    ‘Contacts’,
    ‘LBL_JJWG_MAPS_ADMIN_ADDRESS_CACHE_TITLE’,
    ‘LBL_JJWG_MAPS_ADMIN_ADDRESS_CACHE_DESC’,
    ‘./index.php?module=jjwg_Address_Cache&action=index’
    );

    $admin_group_header[]= array(
    ‘LBL_JJWG_MAPS_ADMIN_HEADER’,
    ”,
    false,
    $admin_option_defs,
    ‘LBL_JJWG_MAPS_ADMIN_DESC’
    );

Trackbacks and Pingbacks:

  1. Customize Admin Panel - December 9, 2012

    […] […]

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