Anda dapat melakukannya dengan menggunakan, Perusahaan / Modulename / etc / adminhtml / system.xml
Di bawah bagian -> bidang grup
<field id="mapping" translate="label comment tooltip" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Customer Fields Mapping</label>
<frontend_model>Company\Modulename\Block\Adminhtml\System\Config\Form\Field\Customermap</frontend_model>
<backend_model>Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</backend_model>
<comment>
<![CDATA[Add the comments!]]>
</comment>
<tooltip>Map the magento customer field to custom module merge_fields</tooltip>
</field>
Dalam file model frontend di dalam blok,
<?php
namespace Company\Modulename\Block\Adminhtml\System\Config\Form\Field;
class Customermap extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray
{
/**
* @var \Magento\Framework\Data\Form\Element\Factory
*/
protected $_elementFactory;
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Data\Form\Element\Factory $elementFactory
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Data\Form\Element\Factory $elementFactory,
array $data = []
)
{
$this->_elementFactory = $elementFactory;
parent::__construct($context,$data);
}
protected function _construct()
{
$this->addColumn('field1', ['label' => __('Field1')]);
$this->addColumn('field2', ['label' => __('FIeld2')]);
$this->_addAfter = false;
$this->_addButtonLabel = __('Add');
parent::_construct();
}
}
Anda memiliki tabel tampilan di area konfigurasi dan setelah menyimpan nilainya disimpan di dalam core_config_data
tabel.