AnsweredAssumed Answered

Add HTML to subpanel through logic hook

Question asked by Jim Forrester on Jul 21, 2016
Latest reply on Jul 22, 2016 by Jim Forrester

I'm putting together a package that contains a custom module that's shown in an Opportunity sub-panel in Sugar 7.7.  What I want to do is combine two fields from the sub-panel into a single column with a link to a URL with friendly text, so I'm using a process_record logichook.

 

Here's the basic code:

<?php
class SalesWinLinkHook {
   public function getListValue(&$bean, $event, $arguments) {
   $url = $bean->saleswinurl;
   if (strpos($url,'.com')!==false) {
   $bean->saleswinlink = '<a target=_blank href=' . $url . '>' . $bean->saleswintitle . '</a>';
  } else {
   $bean->saleswinlink = '';
  }
  }
}

 

From my vardefs.php for this module:

'saleswinlink' =>
   array (
   'name' => 'saleswinlink',
   'vname' => 'LBL_SALESWINLINK',
   'type' => 'html',
   'source' => 'non-db',
  ),

 

From my subpanel-list.php, I have the following:

array(
   'label' => 'LBL_SALESWINLINK',
   'default' => true,
   'link' => true,
   'name' => 'saleswinlink',
),

 

I've modified my manifest to install the logic hook.  After installing the package, the saleswinlink column is being HTML-encoded, so the HTML shows as plain text, rather than showing my link, i.e.: &lt;a target=_blank href=https://www.google.com>Google</a>

Does anybody have any suggestions?

 

Thanks very much in advance,

Jim

Outcomes