×
This forum has been locked. Please submit new Feature Requests on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Checkbox to make field hidden without content
Walt Sorensen
Bronz Üye
Posts: 54
8 yıl 11 ay önce #1100
Yazan: Walt Sorensen
Checkbox to make field hidden without content, Walt Sorensen tarafından oluşturuldu
It would be great if there was a checkbox in the field settings to make the field hidden if there is no content
(Note: would not be an option if the field is "required")
Basic idea is to limit what is displayed for an item view by wrapping the output in a conditional check.
If there is content for the field, then the front end view should display that field; other wise skip that output.
example old code for a link text field (modified to actually be a link) for a front end view
<tr>
<th><?php echo JText::_('COM_STUDIESMANAGER_FORM_LBL_STUDY_LINK'); ?></th>
<td><a href="<?php echo $this->item->link; ?>"><?php echo $this->item->link; ?></a></td>
</tr>
suggested new code format if this field had the new check box to hide the field if there is no content for a front end view
<?php if ($this->item->link): ?>
<tr>
<th><?php echo JText::_('COM_STUDIESMANAGER_FORM_LBL_STUDY_LINK'); ?></th>
<td><a href="<?php echo $this->item->link; ?>"><?php echo $this->item->link; ?></a></td>
</tr>
<?php endif; ?>
(Note: would not be an option if the field is "required")
Basic idea is to limit what is displayed for an item view by wrapping the output in a conditional check.
If there is content for the field, then the front end view should display that field; other wise skip that output.
example old code for a link text field (modified to actually be a link) for a front end view
<tr>
<th><?php echo JText::_('COM_STUDIESMANAGER_FORM_LBL_STUDY_LINK'); ?></th>
<td><a href="<?php echo $this->item->link; ?>"><?php echo $this->item->link; ?></a></td>
</tr>
suggested new code format if this field had the new check box to hide the field if there is no content for a front end view
<?php if ($this->item->link): ?>
<tr>
<th><?php echo JText::_('COM_STUDIESMANAGER_FORM_LBL_STUDY_LINK'); ?></th>
<td><a href="<?php echo $this->item->link; ?>"><?php echo $this->item->link; ?></a></td>
</tr>
<?php endif; ?>
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Sayfa oluşturma süresi: 0.048 saniye