'RTP-1', 'variants' => [ [ 'title' => 'RTP-1.0', 'number' => '1.0.112233', 'prices' => [ ['minQuantity' => 10, 'maxQuantity' => 19, 'price' => 99.9], ['minQuantity' => 20, 'maxQuantity' => 40, 'price' => 79.9], ['minQuantity' => 40, 'maxQuantity' => null, 'price' => 59.9], ], ], ], ]; protected function _initElements() { $this->addElement('text', 'title', ['label' => 'Title', 'required' => true]); $this->addVariants(); return parent::_initElements(); } protected function addVariants() { $name = 'variants'; $options = [ 'name' => $name, 'label' => 'Variants', 'defaults' => Qs_Array::get($this->_defaults, $name, []), 'orientation' => Table::ORIENTATION_VERTICAL, 'itemClass' => SubForm\Variant\Row::class, 'removable' => true, 'itemName' => 'Variant', ]; $this->addSubForm(new SubForm\Variant\Table($options), $name); /** @var \Qs_Form_Decorator_DtDdWrapper $wrapper */ if (($wrapper = $this->getSubForm('variants')->getDecorator('DtDdWrapper'))) { $wrapper->setDdAttrib('class', 'sale-type-' . $this->_getData('saleOptions[type]')); } return $this; } }