I'm having trouble creating Admin settings parameters for a custom module using SugarCRM 8.2. First, while following this post I created a new panel on the Admin page with a single link link inside of it by placing this code in custom\Extension\modules\Administration\Ext\Administration\MonitorSugar2SvcNowAdminPanel.php
:
$admin_option_defs = array();
$admin_option_defs['Administration']['MonitorSugar2SvcNowConfiguration'] = array(
"LBL_MONITORSUGAR2SVCNOW_ADMIN_LINK",
"LBL_MONITORSUGAR2SVCNOW_ADMIN_LINK_TITLE",
"LBL_MONITORSUGAR2SVCNOW_ADMIN_LINK_DESC",
"./index.php?module=snow_Sugar2SvcNowIntegration&action=monitorSugar2SvcNow-settings"
);
$admin_group_header[]= array(
'LBL_MONITORSUGAR2SVCNOW_ADMIN_PANEL_TITLE',
'',
false,
$admin_option_defs,
'LBL_MONITORSUGAR2SVCNOW_ADMIN_PANEL_DESC'
);
Next, I tried to have the link in the Admin panel point to a form with a single text field, where the administrator will be able to enter email addresses to be used by the custom module to send automatic notifications. The custom module is called snow_Sugar2SvcNowIntegration and the settings are used by a scheduled job called MonitorSugar2SvcNowConfiguration. While following this post and the "Creating Layouts" page of the Developer Guide, I added layout and view files like this:
Layout in custom\clients\base\layouts\monitorSugar2SvcNow-settings\monitorSugar2SvcNow-settings.php
$viewdefs['base']['layout']['monitorSugar2SvcNow-settings'] = array(
'type' => 'simple',
'components' => array(
array(
'view' => 'monitorSugar2SvcNow-settings',
),
),
);
View in custom\clients\base\views\monitorSugar2SvcNow-settings\monitorSugar2SvcNow-settings.hbs
<p> Hello world.</p>
Controller in custom\clients\base\views\monitorSugar2SvcNow-settings\monitorSugar2SvcNow-settings.js
{
className: 'monitorSugar2SvcNow-settings',
});
All I expect here is to see "Hello world" when pointing to <my sugar URL>/#snow_Sugar2SvcNowIntegration/layout/monitorSugar2SvcNow-settings
. Instead, I see a blank white page. The route specified in $admin_option_defs
(see above) is actually <sugar URL>/#snow_Sugar2SvcNowIntegration/monitorSugar2SvcNow-settings
. When I go to this URL, I get a "page does not exist" error. Could someone please point out what I'm missing here?
Never mind, I fixed it. "layout" had to be added to the route in $admin_option_defs like this:
"./index.php?module=snow_Sugar2SvcNowIntegration&action=layout/monitorSugar2SvcNow-settings"