|
@@ -29,6 +29,23 @@ class BsSubFormFieldRenderer extends FieldRenderer
|
|
{
|
|
{
|
|
$oOutput = new RenderingOutput();
|
|
$oOutput = new RenderingOutput();
|
|
|
|
|
|
|
|
+ // Checking if subform has visible fields
|
|
|
|
+ $bHasVisibleFields = false;
|
|
|
|
+ foreach ($this->oField->GetForm()->GetFields() as $oSubFormField)
|
|
|
|
+ {
|
|
|
|
+ $sSubFormFieldClass = get_class($oSubFormField);
|
|
|
|
+ // Note : This is a dirty hack for templates. As they show a label when there is no template, we have to detect it...
|
|
|
|
+ if (($sSubFormFieldClass !== 'Combodo\iTop\Form\Field\HiddenField') && ($oSubFormField->GetId() !== '_no_template_'))
|
|
|
|
+ {
|
|
|
|
+ $bHasVisibleFields = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Showing subform if there are visible fields
|
|
|
|
+ if (!$bHasVisibleFields)
|
|
|
|
+ {
|
|
|
|
+ $oOutput->AddHtml('<div class="hidden">');
|
|
|
|
+ }
|
|
if (($this->oField->GetLabel() !== null) && ($this->oField->GetLabel() !== ''))
|
|
if (($this->oField->GetLabel() !== null) && ($this->oField->GetLabel() !== ''))
|
|
{
|
|
{
|
|
$oOutput->AddHtml('<fieldset><legend>' . $this->oField->GetLabel() . '</legend>');
|
|
$oOutput->AddHtml('<fieldset><legend>' . $this->oField->GetLabel() . '</legend>');
|
|
@@ -39,6 +56,10 @@ class BsSubFormFieldRenderer extends FieldRenderer
|
|
{
|
|
{
|
|
$oOutput->AddHtml('</fieldset>');
|
|
$oOutput->AddHtml('</fieldset>');
|
|
}
|
|
}
|
|
|
|
+ if (!$bHasVisibleFields)
|
|
|
|
+ {
|
|
|
|
+ $oOutput->AddHtml('</div>');
|
|
|
|
+ }
|
|
|
|
|
|
$oRenderer = new BsFormRenderer($this->oField->GetForm());
|
|
$oRenderer = new BsFormRenderer($this->oField->GetForm());
|
|
$aRenderRes = $oRenderer->Render();
|
|
$aRenderRes = $oRenderer->Render();
|