Added ability to add/edit note fields in Magento Admin.

This commit is contained in:
shopkeeperdev
2025-10-07 18:57:28 -04:00
parent 44c5b511a3
commit fcc8697c75
5 changed files with 186 additions and 38 deletions

View File

@@ -0,0 +1,41 @@
<?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);
}
}