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.

Last questions

Question regarding custom fields
How do I access custom fields after I have created them?...
0 Replies
Posted on Wednesday, 24 April 2024
  • New
    • #custom fields
    Google no index für bestimmte Seiten/Details
    Hallo ich habe eine kleine Frage: wo kann ich einstellen, dass Google die Seite...
    0 Replies
    Posted on Wednesday, 24 April 2024
  • New
  • Language parameter in the link to the comment
    Hello. 1) I have a multilingual website (3 languages). If someone added a comme...
    1 Replies
    Posted on Saturday, 06 April 2024
    categories icon in header
    Hi! I saw this in the promo, but I can't find how to set it up. https://compo...
    0 Replies
    Posted on Monday, 22 April 2024
  • New
    • #style
    • #Categories
    Questions on new installation...
    Working on getting this set up... https://eastend2024.joepolecheck.com/rumma...
    3 Replies
    Posted on Wednesday, 17 April 2024
  • Resolved
  • New