Added ability to add/edit note fields in Magento Admin.
This commit is contained in:
41
Block/Adminhtml/Form/Field/VendorMapping.php
Normal file
41
Block/Adminhtml/Form/Field/VendorMapping.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user