Magento 2: available field types in system.xml
-
05-10-2020 - |
Question
What are available values for field types in etc/system.xml
configuration file:
<?xml version="1.0"?>
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="...">
<group id="...">
<field id="..." type="???">
...
</field>
</group>
</section>
</system>
</config>
Solution
Magento 2 system configuration provides below fields type.
checkbox,
checkboxes,
column,
date,
editablemultiselect,
editor,
fieldset,
file,
gallery,
hidden,
image,
imagefile,
label,
link,
multiline,
multiselect,
note,
obscure,
password,
radio,
radios,
reset,
select,
submit,
text,
textarea,
time
OTHER TIPS
Looking at the file /lib/internal/Magento/Framework/Data/Form/Element/Factory.php
(sources on Github, for Magento 2.2 & 2.3), one can find the following default list of elements, as specified by Amit in his answer:
// Factory.php, lines 26-55
protected $_standardTypes = [
'button',
'checkbox',
'checkboxes',
'column',
'date',
'editablemultiselect',
'editor',
'fieldset',
'file',
'gallery',
'hidden',
'image',
'imagefile',
'label',
'link',
'multiline',
'multiselect',
'note',
'obscure',
'password',
'radio',
'radios',
'reset',
'select',
'submit',
'text',
'textarea',
'time',
];
If Composer was used to install Magento, the data may also be found in /vendor/magento/framework/Data/Form/Element/Factory.php
, as mentioned in Mohit's comment below.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange