public function testCustomCodeRenderField() { $params = array('var' => array('name' => 'name', 'comment' => 'Name of the Company', 'label' => 'LBL_NAME', 'displayParams' => array('enableConnectors' => '1', 'module' => 'Accounts'), 'customCodeRenderField' => '1', 'customCode' => '<a href="http://www.google.com?q={$fields.name.value}">Search</a>', 'tabindex' => '100'), 'colData' => array('field' => array('name' => 'name', 'comment' => 'Name of the Company', 'label' => 'LBL_NAME', 'displayParams' => array('enableConnectors' => '1', 'module' => 'Accounts'), 'customCodeRenderField' => '1', 'customCode' => '<a href="http://www.google.com?q={$fields.name.value}">Search</a>', 'tabindex' => '100'))); require_once 'include/Sugar_Smarty.php'; $ss = new Sugar_Smarty(); $ss->left_delimiter = '{{'; $ss->right_delimiter = '}}'; require_once 'include/Smarty/plugins/function.sugar_evalcolumn.php'; $output = smarty_function_sugar_evalcolumn($params, $ss); //Doing this the hack way...customCode is 65 chars long. //if customCodeRenderField is set then the connectors have already been processed $this->assertEquals(65, strlen($output), 'Connectors should not be processed when customCode is set to customCodeRenderField'); //now if customCodeRenderField is not set then process as normal unset($params['var']['customCodeRenderField']); unset($params['colData']['field']['customCodeRenderField']); $output = smarty_function_sugar_evalcolumn($params, $ss); $this->assertGreaterThan(65, strlen($output), 'Connectors should not be processed when customCode is set to customCodeRenderField'); }
?> &stamp=<?php echo $this->_tpl_vars['pageData']['stamp']; ?> ' class='listViewTdLinkS1'><?php echo $this->_tpl_vars['rowData'][$this->_tpl_vars['col']]; ?> </<?php echo is_array($_tmp = @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']][$this->_tpl_vars['params']['ACLTag']]) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']); ?> > <?php } elseif ($this->_tpl_vars['params']['customCode']) { ?> <?php echo smarty_function_sugar_evalcolumn(array('var' => $this->_tpl_vars['params']['customCode'], 'rowData' => $this->_tpl_vars['rowData']), $this); ?> <?php } elseif ($this->_tpl_vars['params']['currency_format']) { ?> <?php echo smarty_function_sugar_currency_format(array('var' => $this->_tpl_vars['rowData'][$this->_tpl_vars['col']], 'round' => $this->_tpl_vars['params']['currency_format']['round'], 'decimals' => $this->_tpl_vars['params']['currency_format']['decimals'], 'symbol' => $this->_tpl_vars['params']['currency_format']['symbol']), $this); ?> <?php } elseif ($this->_tpl_vars['params']['type'] == 'bool') { ?> <input type='checkbox' disabled=disabled class='checkbox' <?php if (!empty($this->_tpl_vars['rowData'][$this->_tpl_vars['col']])) {
<?php echo smarty_function_sugar_field(array('parentFieldArray' => 'fields', 'vardef' => $this->_tpl_vars['fields'][$this->_tpl_vars['colData']['field']['name']], 'displayType' => 'DetailView', 'displayParams' => $this->_tpl_vars['colData']['field']['displayParams'], 'typeOverride' => $this->_tpl_vars['colData']['field']['type']), $this); ?> <?php } ?> <?php if (!empty($this->_tpl_vars['colData']['field']['customCode']) && $this->_tpl_vars['colData']['field']['customCodeRenderField']) { ?> {counter name="panelFieldCount"} <span id="<?php echo $this->_tpl_vars['colData']['field']['name']; ?> " class="sugar_field"><?php echo smarty_function_sugar_evalcolumn(array('var' => $this->_tpl_vars['colData']['field'], 'colData' => $this->_tpl_vars['colData']), $this); ?> </span> <?php } ?> <?php echo $this->_tpl_vars['colData']['field']['suffix']; ?> <?php if (!empty($this->_tpl_vars['colData']['field']['name'])) { ?> {/if} <?php }