initIds('firewallOptionSection'); $this->leftSection = new HalfPageSection('leftSection'); $this->rightSection = new HalfPageSection('rightSection'); $this->addSection($this->leftSection) ->addSection($this->rightSection); $this->initFields(); } private function initFields() { //enable $field = new Switcher("customconfigoption[firewalOptionEnable]"); $this->addField($field); //dhcp $field = new Switcher("customconfigoption[firewalOptionDhcp]"); $field->setDefaultValue("on"); $this->addField($field); //ndp $field = new Switcher("customconfigoption[firewalOptionNdp]"); $field->setDefaultValue("on"); $this->addField($field); //radv $field = new Switcher("customconfigoption[firewalOptionRadv]"); $this->addField($field); //macfilter $field = new Switcher("customconfigoption[firewalOptionMacfilter]"); $field->setDefaultValue("on"); $this->addField($field); //ipfilter $field = new Switcher("customconfigoption[firewalOptionIpfilter]"); $this->addField($field); } public function addField($field){ $total = count($this->leftSection->getFields()) + count($this->rightSection->getFields()); if($total % 2 == 0){ $this->leftSection->addField($field); }else{ $this->rightSection->addField($field); } return $this; } }