1. Paul Adamson
  2. Bug report
  3. Wednesday, 26 July 2017
  4.  Subscribe via email
Hi, just something I observed while working with the component for the first time. I created a custom field list for hotspots and noticed the field was not being rendered for some hotspots, maybe about 30% of them. I traced it down to the fact that I had created a zero-based list index, and for any hotspot that had the first item in the list selected, the field was not rendered. That's because in the file views/hotspot/tmpl/default.php (and its layout override), this line is used to test the field value:


<?php if ($this->hotspot->customfields && $this->customFields) : ?>
<div class="hotspots-customfields">
<?php foreach ($this->hotspot->customfields as $key => $customFields): ?>
<?php if (isset($this->customFields[$key])) : ?>
<?php if ($customFields): ?> // <----------- RIGHT HERE
<dl class="dl-horizontal">
<dt><?php echo JText::_($this->customFields[$key]->title); ?></dt>
<dd><?php echo CompojoomFormCustom::render($this->customFields[$key], $customFields); ?></dd>
</dl>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>


With a zero-based index, the field is never rendered. I worked around it by reindexing my select values.

Is there a reason that we don't test for isset($customFields) instead of just $customFields evaluating true?

Cheers
Paul
Responses (0)


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Powered by EasyDiscuss for Joomla!