<?php
// Copyright (c) MetaClass Groningen, 2014-2015

namespace VisualM\ManagementBundle\Form;


class Tab extends Fieldset {

    public $fieldsets = array();
    public $active = false;

    public function addFieldset(Fieldset $fieldset, $key=null)
    {
        if ($key === null) {
            $this->fieldsets[] = $fieldset;
        } else {
            $this->fieldsets[$key] = $fieldset;
        }
        return $this;
    }

    public function hasFormName($name)
    {
        reset($this->fieldsets);
        foreach($this->fieldsets as $set) {
            if ($set->hasFormName($name)) {
                return true;
            }
        }
        return parent::hasFormName($name);
    }

} 