I'm trying to create a layout view for Joomla Articles to customize the way fields of Component DP Fields are rendered in my layouts.
I've created a new file in /templates/mytemplate/html/com_content/article/progetti.php (that is a copy of default.php)
Here I'm trying to put this code (see reference here: [https://joomla.digital-peak.com/documentation/162-dpfields/2750-rendering-fields][1]):
if (! key_exists('field', $displayData))
{
return;
}
$field = $displayData['field'];
$label = $field->label;
$value = $field->value;
if (! $value)
{
return;
}
$class = $field->render_class;
?>
<dd class="dpfield-entry <?php echo $class;?>">
<span class="dpfield-label"><?php echo htmlentities($label);?>: </span>
<span class="dpfield-value"><?php echo $value;?></span>
</dd>
Anyway in this case I've got some errors:
Notice: Undefined variable: displayData in /home/.../.../.../templates/mytemplate/html/com_content/article/progetti.php on line 112
Warning: key_exists() expects parameter 2 to be array, null given in /home/.../.../.../templates/mytemplate/html/com_content/article/progetti.php on line 112
I want to display DPFields' fields in the article customizing the layout. What should I do to correctly let it work?