Code: Select all
$video = $this->item->jcfields[4]->value;
$media = $this->item->jcfields[8]->value;
Code: Select all
<?php if(isset($media) && !empty($media)) : ?>
<!-- Media custom field output -->
<div class="media-block">
<?php echo $media; ?>
</div>
<!-- Media custom field output -->
<?php endif; ?>
Is this an issue with the implementation of the custom fields in the override or something else?
In Joomla 3, I was using the following for adding custom fields to com_content template overrides:
Code: Select all
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
$context = 'com_content.article';
$article = $this->item;
$fields = FieldsHelper::getFields($context, $article, true);
foreach($fields as $field) {
$fields[$field->name] = $field;
}
<!-- Media custom field output -->
<?php if(isset($fields['media']->value) && !empty($fields['media']->value)): ?>
<?php $class = $fields['media']->params->get('render_class'); ?>
<?php echo $fields['media']->value; ?>
<?php endif; ?>
<!-- Media custom field output -->
Cheers,