I want to add a Multiline Input "Textarea" in system.xml searched but not found if anyone can help me
thank you
EDIT
This is how I have created Dynamic Rows
use Vendor\Module\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
use Magento\Framework\DataObject;
class SMSTemplates extends AbstractFieldArray
{
/**
* @var SortOrder
*/
private $orderStatusRenderer;
/**
* @var Status
*/
private $statusRenderer;
/**
* @var Icons
*/
private $templateRenderer;
/**
* Render Sort Order
*
* @return SortOrder
*/
protected function getOrderStatusRenderer()
{
if (!$this->orderStatusRenderer) {
$this->orderStatusRenderer = $this->getLayout()->createBlock(
OrderStatus::class,
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->orderStatusRenderer;
}
/**
* Render Status
*
* @return Status
*/
protected function getStatusRenderer()
{
if (!$this->statusRenderer) {
$this->statusRenderer = $this->getLayout()->createBlock(
Status::class,
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->statusRenderer;
}
/**
* Render Icons
*
* @return Icons
*/
protected function getTemplateRenderer()
{
if (!$this->templateRenderer) {
$this->templateRenderer = $this->getLayout()->createBlock(
Tempalate::class,
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->templateRenderer;
}
/**
* Prepare rendering the new field by adding all the needed columns
*/
protected function _prepareToRender()
{
$this->addColumn('order_status',
[
'label' => __('Order Status'),
'class' => 'required-entry',
]
);
$this->addColumn('status',
[
'label' => __('Status'),
'renderer' => $this->getStatusRenderer(),
]
);
$this->addColumn('template',
[
'label' => __('Template'),
'class' => 'textarea',
'style' => 'textarea'
]
);
$this->_addAfter = false;
$this->_addButtonLabel = __('Add');
}
/**
* Prepare existing row data object
*
* @param DataObject $row
* @return void
*/
protected function _prepareArrayRow(DataObject $row)
{
$orderStatus = $row->getOrderStatus();
$options = [];
if($orderStatus != Null ){
$status = $row->getStatus();
$options['option_' . $this->getStatusRenderer()->calcOptionHash($status)] = 'selected="selected"';
}
$orderStatus = $row->getStatus();
if($_FILES != Null){
$options['option_' . $this->getOrderStatusRenderer()->calcOptionHash($orderStatus)] = 'selected="selected"';
}
$template = $row->getTemplate();
if($template != Null){
$options['option_' . $this->getTemplateRenderer()->calcOptionHash($template)] = 'selected="selected"';
}
$row->setData('option_extra_attrs', $options);
}
/**
* Render Feilds Styling
*
* @param array $columnName
*
* @return void
*/
public function renderCellTemplate($columnName)
{
if ($columnName == "order_status") {
$this->_columns[$columnName]['class'] = 'input-text required-entry';
$this->_columns[$columnName]['style'] = 'width:150px';
}elseif ($columnName == "template") {
$this->_columns[$columnName]['class'] = 'input-text required-entry';
$this->_columns[$columnName]['style'] = 'width:200px; height:200px;';
}
return parent::renderCellTemplate($columnName);
}
}
Here is My System.xml
<group id="sms_templates_settings" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>SMS Templates</label>
<field id="sms_templates" translate="label" sortOrder="101" showInDefault="1" showInWebsite="1" showInStore="1">
<label></label>
<frontend_model>Vendor\Module\Block\Adminhtml\Form\Field\SMSTemplates</frontend_model>
<backend_model>Vendor\Module\Model\Adminhtml\System\Config\SMSTemplates</backend_model>
</field>
</group>
this is how its Gernating but I need last field to me multline