looking at this thread: https://suitecrm.com/suitecrm/forum/developer-help/19607-looking-for-help-in-adding-the-custom-sugarwidget-subpanel#68474 The widget class is still used.
So I have in /var/www/html/custom/modules/Emails/metadata/subpanels/ForHistory.php
'contact_name'=>array(
'widget_class' => 'SubPanelDetailViewLinkEmailCustom',
),
and then /custom/include/generic/SugarWidgets/SugarWidgetSubPanelDetailViewLinkEmailCustom.php
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelDetailViewLinkEmailCustom extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $focus;
$to = array();
$to_addrs = array();
$from = array();
$from_addrs = array();
$cc = array();
$cc_addrs = array();
$return = '';
$email = new Email();
$email->retrieve($layout_def['fields']['ID']);
$to_addrs = array_filter(array_unique(explode(';',str_replace(' ' ,';',str_replace(',',';',$email->to_addrs)))));
$from_addrs = array_filter(array_unique(explode(';',str_replace(' ' ,';',str_replace(',',';',$email->from_addr)))));
$cc_addrs = array_filter(array_unique(explode(';',str_replace(' ' ,';',str_replace(',',';',$email->cc_addrs)))));
$return .= "<small>";
if(!empty($from_addrs)){
$return .= "<b>From: </b>";
foreach($from_addrs as $addr){
if(!empty($addr)) $return .= '<a href="mailto:'.trim($addr).'"><small>' . trim($addr) .'</small></a><br>';
}
}
if (!empty($to_addrs)){
$return .= "<br><b>To: </b>";
foreach($to_addrs as $addr){
if(!empty($addr)) $return .= '<a href="mailto:'.trim($addr).'"><small>' . trim($addr) .'</small></a><br>';
}
}
if(!empty($cc_addrs)){
$return .= "<br><b>Cc: </b>";
foreach($cc_addrs as $addr){
if(!empty($addr)) $return .= '<a href="mailto:'.trim($addr).'"><small>' . trim($addr) .'</small></a><br>';
}
}
$return .= "</small>";
return($return);
}
}
These are copied from the post https://community.sugarcrm.com/thread/18716 with the addition of these lines at the to of SugarWidgetSubPanelDetailViewLinkEmailCustom.php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
and the contact field in the history panel for emails is still blank.,
I have also changed the
return($return);
to
return("hello");
at the end of the widget and there is still nothing in the contact field in the sub panel, I would assume this means the widget isn’t even being called?
Any Help would be great.