AnsweredAssumed Answered

Creating a new subpanelwidget

Question asked by Navneet Golwalkar on Apr 9, 2014
Hi all,
Im trying to create a new subpanel sugarwidget by extending:
'include/generic/SugarWidgets/SugarWidgetSubPanelDetailViewLink.php'
I would like this to work in the name column of the contacts subpanel in the opportunities module.

So in my new file, 'include/generic/SugarWidgets/SugarWidgetSubPanelBCLink.php' I have:

Code:
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelDetailViewLink.php');

class SugarWidgetSubPanelBCLink extends SugarWidgetSubPanelDetailViewLink
{
  function displayList(&$layout_def)
  {
   print_r($layout_def);
   return parent::displayList(&$layout_def);

  }
}

Then I have modified 'modules/Contacts/metadata/subpanels/default.php' to have:

Code:
 'name'=>array(
   'name'=>'name', 
   'vname' => 'LBL_LIST_NAME',
                 'sort_by' => 'last_name',
                 'sort_order' => 'asc',
   'widget_class' => 'SubPanelBCLink',
    'module' => 'Contacts',
   'width' => '23%',
  ),

and 'modules/Contacts/metadata/subpanels/ForOpportunities.php' to have:

Code:
 'name'=>array(
   'name'=>'name',
   'vname' => 'LBL_LIST_NAME',
   'widget_class' => 'SubPanelBCLink',
    'module' => 'Contacts',
   'width' => '23%',
  ),

However this produces:

Code:
<td valign="top" nowrap="nowrap" scope="row">
<span sugar="slot0b">
Tasha Gibbon
</span>
</td>


So although my change of printing $layout_def isnt happening the extra markup that SugarWidgetSubPanelDetailViewLink puts in the name is gone, leaving it as a basic span.

Does anyone know what might be causing this?

Thanks

Outcomes