I’m trying to override the SugarWidgetSubPanelTopScheduleMeetingButton of an Activities subpanel by creating a custom button that extends SugarWidgetSubPanelTopButtonQuickCreate.
however, the new button loses the reference to ‘schedule meeting’ and outputs the following :
<a id="Activities__button"></a>
The ‘onsubmit’ and other properties are set in \custom\include\generic\SugarWidgets\MyNewButton.php, but i cannot work out how the ID of the ‘a’ tag is set.
However, when i override the button (but without changing any code within it), i get the following; and you can see that the ID of the <a> tag (and its content) has changed and the words ‘Schedule meeting’ have been omitted.
i deleted the entire custom folder (and don’t recall making any non upgrade safe changes) but unfortunately the issue remains for me with 7.11.10, Sugar Version 6.5.25 (Build 344).
i thought i could override the layoutManager via the custom folder in the same way the buttons are overridden. However looks as though its not possible to override the layout manager.
So although i can substitute the button in a safe way, setting the label is more of a problem. Neither the Activities language file or the layout manager appear to check the custom folder
I wanted to override the ‘Schedule Meeting’ button on the ‘Activities’ SubPanel of an Opportunity, in order to pass additional fields from an Opportunity when quick creating a Meeting. I have it working but its not upgrade safe:
Created the new custom button:
Copy include/generic/SugarWidgets/SugarWidgetSubPanelTopScheduleMeetingButton.php
to custom/include/generic/SugarWidgets/SugarWidgetSubPanelTopScheduleMeetingButton_c.php
Edit the new file and change its class name to match the filename of SugarWidgetSubPanelTopScheduleMeetingButton_c
Add the fields to be passed, in the display function of the new file; for example :
public function display($defines, $additionalFormFields = null, $nonbutton = false)
{
$focus = new Meeting;
if (!$focus->ACLAccess(‘EditView’)) {
return ‘’;
} $additionalFormFields[‘description’] = $defines[‘focus’]->description;
return parent::display($defines, $additionalFormFields);
}
At this point the new button was working but it lost its label and appeared a blank button with no label.
To fix this I needed to add the new button to the class_map array in LayoutManager.
Open the file include/generic/LayoutManager.php and add the button definition to the $class_map array within the getClassFromWidgetDef() function.
public function getClassFromWidgetDef($widget_def, $use_default = false) {
‘SugarWidgetSubPanelTopScheduleMeetingButton_c’ => array(
‘widget_class’=>‘SugarWidgetSubPanelTopScheduleMeetingButton_c’,
‘module’=>‘Meetings’,
‘title’=>‘LBL_NEW_BUTTON_TITLE’,
‘access_key’=>‘CUSTOM BUTTON NAME’,
‘form_value’=>’’,
‘ACL’=>‘edit’,
),
Tell the Activities sub panel to use the button
Open custom/modules/Opportunities/metadata/subpaneldefs.php and make the following change