Bug in News module version 2.15.1?
Posted: Sun Jun 28, 2015 3:19 pm
It appears that in the latest version of the News module $entry->fields is always set (or never empty), even if there is nothing in that field. I don’t think this used to be the case before. I have a file upload field and this is the code in my summary template:
And if I do a check inside the loop for:
it always returns false, even if a value is set.
Am I doing something wrong or is there a bug in the News module?
Code: Select all
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
<div class="extrafeld">
{if $field->type === 'file'}
{assign var='fileArray' value='.'|explode:$field->displayvalue}
{if $fileArray|end|lower === 'png' || $fileArray|end|lower === 'jpg' || $fileArray|end|lower === 'jpeg' || $fileArray|end|lower === 'gif'}
{cms_module module="CGSmartImage" src="{$entry->file_location}/{$field->displayvalue}" alt="" filter_resize="w,200"}
{elseif $fileArray|end|lower === 'pdf'}
<object data="{$entry->file_location}/{$field->displayvalue}" type="application/pdf">
<a href="{$entry->file_location}/{$field->displayvalue}">{$field->displayvalue}</a>
</object>
{/if}
{else}
{$field->name}: {$field->displayvalue}
{/if}
</div>
{/foreach}
{/if}
Code: Select all
{if !empty($field->displayvalue)}
Am I doing something wrong or is there a bug in the News module?