Hi folks,
I have a requirement where-by I have created a new scripted field (contains HTML) (not utilising studio) and im using the api to populate this. What I now need to do is output the content of this field and render it as HTML.
The field should display within a new tab within the Products module without any form label etc and just purely output the value.
Please can anyone share any suggestions?
1 Like
@CNSam
Welcome to community!
You can use parameter customCode
for forms editviewdefs.php
or/and detailviewdefs.php
and you can leave blank label for the field. For exmple:
...
'LBL_PANEL_0' => array (
0 => array (
0 => array (
'name' => 'field_api_html',
'customCode' => '<span class="label" style="font-size: larger;">{$fields.field_api_html.value}</span>',
),
),
),
...
Why not use the standard iframe field that you can add from Studio?
1 Like
We aren’t hosting the page anywhere so not able to use iframe.
I did try using the afore mentioned customCode but it just output the html code and didn’t render it as html.
See this to get Smarty to leave your HTML in place as it is:
@CNSam
As a variant you can set field type function
(There is type=>int
in example change it). Look at the post. Function can return html.
@2di7
The hook ‘process_record’ called for each record of a module separately.
Can I suggest an option? You can decide your task if you will use special parametr ‘function’ for a filed. As an example:
I make the field ‘age_years’. The field is calculating the age of contact.
The file - custom/Extension/modules/Contacts/Ext/Vardefs/age_years.php:
<?php
$dictionary['Contact']['fields']['age_years'] =
array (
'name' => 'age_years',
'vname' => 'LBL_AGE_YEARS',
'type' => 'int',
…
2 Likes