namespace Combodo\iTop\Renderer\Bootstrap\FieldRenderer;
use \Dict;
use Combodo\iTop\Renderer\Bootstrap\BsFormRenderer;
use Combodo\iTop\Renderer\FieldRenderer;
use Combodo\iTop\Renderer\RenderingOutput;
class BsSubFormFieldRenderer extends FieldRenderer
{
public function Render()
{
$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('
');
}
if (($this->oField->GetLabel() !== null) && ($this->oField->GetLabel() !== ''))
{
$oOutput->AddHtml('');
}
if (!$bHasVisibleFields)
{
$oOutput->AddHtml('