/** * Add an area to the internal elements collection. * * See {@link \ValidFormBuilder\Area} for examples * * @param string $label The title of this area * @param string $active If `true`, the title has a checkbox which can enable or disable all child elements * @param string $name The ID of this area * @param string $checked Use in combination with `$active`; if `true`, the checkbox will be checked by default * @param array $meta The meta array * * @return \ValidFormBuilder\Area */ public function addArea($label = null, $active = false, $name = null, $checked = false, $meta = array()) { $objArea = new Area($label, $active, $name, $checked, $meta); $objArea->setRequiredStyle($this->__requiredstyle); // *** Fieldset already defined? $objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset"); if ($this->__elements->count() == 0 || !is_object($objFieldset)) { // No fieldset found in the elements collection, add a fieldset. $objFieldset = $this->addFieldset(); } $objArea->setMeta("parent", $objFieldset, true); // *** Add field to the fieldset. $objFieldset->addField($objArea); return $objArea; }