Difference between sugar_html and customCode in metadata?

What’s the difference between the two? I found them in detailsview metadata.

Sorry, I don’t understand the question. Perhaps if you post the full paths of what you mean it will be easier. Thanks

Sample From custom/modules/Employees/metadata/detailsviewdefs.php


<?php
$viewdefs ['Employees'] = 
array (
  'DetailView' => 
  array (
    'templateMeta' => 
    array (
      'form' => 
      array (
        'buttons' => 
        array (
          0 => 
          array (
            'customCode' => '{if $DISPLAY_EDIT}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'{$module}\'; this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$id}\'; this.form.action.value=\'EditView\'" type="submit" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if}',
            'sugar_html' => 
            array (
              'type' => 'submit',
              'value' => '{$APP.LBL_EDIT_BUTTON_LABEL}',
              'htmlOptions' => 
              array (
                'title' => '{$APP.LBL_EDIT_BUTTON_TITLE}',
                'accessKey' => '{$APP.LBL_EDIT_BUTTON_KEY}',
                'class' => 'button',
                'onclick' => 'this.form.return_module.value=\'{$module}\'; this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$id}\'; this.form.action.value=\'EditView\';',
                'id' => 'edit_button',
                'name' => 'Edit',
              ),
              'template' => '{if $DISPLAY_EDIT}[CONTENT]{/if}',
            ),

I don’t really know.

I just had a look. The first half of this file seems relevant:

https://github.com/salesagility/SuiteCRM/blob/master/include/SugarHtml/SugarHtml.php

See the large comment, and functions createHtml and parseSugarHtml

Also interesting is this comment, repeated several times:
https://github.com/salesagility/SuiteCRM/blob/master/modules/EAPM/metadata/detailviewdefs.php#L52

The custom code will be replaced with sugar_html. customCode will be deplicated.

This seems to come from the SugarCRM days, but it definitely hasn’t been “deplicated” yet :slight_smile:

1 Like