I want to know if someone has already added a select field in a generated admin fields
Vendor/Name/Block/Adminhtml/Menu/Field/AdditionalMenu.php
<?php
namespace Vendor\Menu\Block\Adminhtml\Menu\Field;
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
/**
* Class AdditionalMenu
*/
class AdditionalMenu extends AbstractFieldArray
{
protected $_itemRenderer;
/**
* {@inheritdoc}
*/
protected function _prepareToRender()
{
$this->addColumn(
'Title',
['label' => __('Title'),
'size' => '200px',
'class' => 'required-entry']
);
//Option test
/*$this->addColumn('Type',
array('label' => __('Type'),
'type' =>'options',
'options' => array('Option 1', 'Option 2')
));*/
$this->addColumn(
'Link',
['label' => __('Link'),
'size' => '200px']
);
$this->addColumn(
'Ordre',
['label' => __('Ordre'),
'size' => '50px',
'class' => '']
);
$this->_addAfter = false;
$this->_addButtonLabel = __('Ajouter un Menu');
}
}
Best Answer
I found the solution:
How to add a select options column :
Vendor\Name\Block\Adminhtml\Menu\Config\Backend\Options.php