Skip to content

Commit

Permalink
Remove StringHelper dependency and add check to fieldset rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
matrikular committed Nov 19, 2015
1 parent e119c7f commit aae307c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions components/com_contact/views/contact/tmpl/default_form.php
Expand Up @@ -9,18 +9,21 @@

defined('_JEXEC') or die;

use \Joomla\String\StringHelper;

JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');

$captchaEnabled = (JFactory::getApplication()->get('captcha', '0') !== '0' && !empty(JPluginHelper::getPlugin('captcha')));
?>
<div class="contact-form">
<form id="contact-form" action="<?php echo JRoute::_('index.php'); ?>" method="post" class="form-validate form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<?php foreach ($this->form->getFieldsets() as $fieldset): ?>
<?php if ($fieldset->name === 'captcha' && !$captchaEnabled) : ?>
<?php continue; ?>
<?php endif; ?>
<?php $fields = $this->form->getFieldset($fieldset->name); ?>
<?php if (count($fields)) : ?>
<fieldset>
<?php if (isset($fieldset->label) && StringHelper::strlen($legend = trim(JText::_($fieldset->label)))) : ?>
<?php if (isset($fieldset->label) && strlen($legend = trim(JText::_($fieldset->label)))) : ?>
<legend><?php echo $legend; ?></legend>
<?php endif; ?>
<?php foreach ($fields as $field) : ?>
Expand Down

0 comments on commit aae307c

Please sign in to comment.