setTemplate('Magento_Config::system/config/form/field/array.phtml'); } /** * Prepare rendering the new field by adding all the needed columns */ protected function _prepareToRender() { $this->addColumn('vendor_name', [ 'label' => __('Vendor Name'), 'class' => 'required-entry', 'style' => 'width:200px' ]); $this->addColumn('note', [ 'label' => __('Note'), 'class' => 'required-entry', 'style' => 'width:400px' ]); $this->_addAfter = false; $this->_addButtonLabel = __('Add Vendor Note'); } /** * Obtain existing data from form element * * Each row will be instance of Varien_Object * * @return array */ public function getArrayRows() { $result = []; /** @var DataObject $row */ foreach (parent::getArrayRows() as $key => $row) { // Ensure row IDs are prefixed with a non-numeric character if (is_numeric($key)) { $key = 'row_' . $key; } $result[$key] = $row; } return $result; } /** * Prepare existing row data object * * @param DataObject $row * @throws \Magento\Framework\Exception\LocalizedException */ protected function _prepareArrayRow(DataObject $row): void { $options = []; $row->setData('option_extra_attrs', $options); } }