Files
module-vendor-notes/Block/Adminhtml/Form/Field/VendorMapping.php
2025-10-07 18:57:28 -04:00

41 lines
1.1 KiB
PHP

<?php
namespace Shopkeeper\VendorNotes\Block\Adminhtml\Form\Field;
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
use Magento\Framework\DataObject;
class VendorMapping extends AbstractFieldArray
{
/**
* 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');
}
/**
* 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);
}
}