Looking for help - in Adding the Custom SugarWidget SubPanel

Hi,
I have tired to create a custom SugarWidgetSubpanel and called the ‘widget_class’ => ‘SubPanelCustomButton.’
but the function inside the class is not working. same code i have pasted in some other widget for example in ‘SugarWidgetSubPanelEmailLink,php’ then it was working fine

so i have tried this in both the path :

include\generic\SugarWidgets\SugarWidgetSubPanelCustomButton.php
custom\include\generic\SugarWidgets\SugarWidgetSubPanelCustomButton.php

But still not Working… Do i want to add the ‘SubPanelCustomButton’ anywhere else ?

If you provide more details like:
. SuiteCRM Version
. PHP, Webserver, O/S
as well as the code that you are trying to get to work and the affected files so that someone willing to help can test it and possibly debug it

Further more you should provide SuiCRM, PHP/Webserver and Browser javascript console error logs.

Failing to do so I presume that it is almost impossible to help you!

Hi, Thanks for your Reply

SuiteCRM version : 7.10.7
PHP. Version : 7.2
OS: windows

Added Custom Code For test testing Custom SugarWidget subpanel

Path : include\generic\SugarWidgets\SugarWidgetSubPanelCustomButton.php

Code::

<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); require_once('include/generic/SugarWidgets/SugarWidgetField.php'); class SugarWidgetSubPanelCustomButton extends SugarWidgetField{ function displayList(&$layout_def){ echo "This Function is working"; exit(); } } called this class in Path: modules//metadata/subpanels/default.php default supanel widget_class' => 'SubPanelCustomButton' Problem Facing: it is calling the class but not the function... Consile Log : there is no Error

How do you know that the class has been called?

How do you know that the function is not called?

To make sure that the function is called you have to add an exit; statement immediately after the echo statement.

In this way the whole script stops and the echo remains on screen.

If you don’t exit there is no way to know because other parts of the script may clear the screen in some way.

With respect to the class I don’t know.

Please post the code using the editor “Code” tag.

Your code is not complete and with what you posted I am unable to replicate the same situation.

Hi, In the above given code i have clearly mentioned the echo and the exit; but the script is not getting stop and not displaying the ECHO… Hence i confirmed function call is not happening

[sup]

<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); require_once('include/generic/SugarWidgets/SugarWidgetField.php'); class SugarWidgetSubPanelCustomButton extends SugarWidgetField{ function displayList(&$layout_def){ echo "This Function is working"; exit(); } }[/sup] When i change the name of the class it show 'SugarWidgetSubPanelCustomButton' class not found hence confirmed class is called... Even if you ddnt understand the code then please check with your our sample example to make the custom sugarwidget work and please help me out.. Thanks in advance :)

Sorry but it is quite difficult to read the code in the way you have have pasted it.

If you paste it using the code tags (there is an icon on the editor ribbon for this) it is much more readable.

I will try altough I am not sure where to place this:

widget_class' => 'SubPanelCustomButton'

If you don’t show the whole thing it is quite unlikely that anyone can spot an error somewhere.

Hi amariussi,

Thanks for you valuable time

Added Custom Code For test testing Custom SugarWidget subpanel

Step 1:

Path : include\generic\SugarWidgets\SugarWidgetSubPanelCustomButton.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
	class SugarWidgetSubPanelCustomButton extends SugarWidgetField{
		function displayList(&$layout_def){
			echo "This Function is working";
		exit();
	}
} 

Step 2: Path: modules/Leads/metadata/subpanels/default.php

in this File go to Line no. 87 you can see widget class…


'widget_class' => 'SubPanelEmailLink',

change this to


'widget_class' => 'SubPanelCustomButton',

Step 3: Quick Repair and Rebuild

Whereever you find the lead subpanel, According to this Code the script should stop and it should display the Echo. But its not happening.

I have the same problem. Did you ever solve the issue?
Thanks,
Dianna