getOptionList() as $option) { $optionItemForm = new OptionItemForm([ 'legend' => 'Indicate Choices for ' . $option['title'], 'choiceList' => $option['choiceList'], ]); $this->addSubForm($optionItemForm, (string) $option['id']); } return $this; } public function getOptionList() { if (empty($this->_optionList)) { throw new \Exception('Required option "' . __CLASS__ . '"->_optionList" is missing'); } return $this->_optionList; } /** * [ * [ * 'id' => int, * 'title' => string, * 'choiceList' => [ * 'id' => int $optionId, * 'title' => string $optionTitle, * ], * ], * ... * ] * * @param $optionList * * @return $this */ public function setOptionList($optionList) { $this->_optionList = $optionList; return $this; } }