In Magento 2 (almost) all arguments listed in xml files have an attribute xsi:type
that determine how the value of the argument is iterpreted.
For example, in di.xml
file of the backend module there is this:
<argument name="scopeType" xsi:type="const">Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT</argument>
this means that the value of the argument scopeType
is the value of the constant Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT
or this one
<argument name="template" xsi:type="string">Magento_Theme::root.phtml</argument>
this means that the value of the argument template
is the string Magento_Theme::root.phtml
.
What are all the possible values of this xsi:type
attribute?
Best Answer
I've found all types by checking
<xs:extension base="argumentType"
in *.xsd files.lib/internal/Magento/Framework/Data/etc/argument/types.xsd
, these are base types:lib/internal/Magento/Framework/ObjectManager/etc/config.xsd
, can be found in di.xml files:lib/internal/Magento/Framework/View/Layout/etc/elements.xsd
, can be found in layout *.xml files:Magento/Ui/etc/ui_components.xsd
, can be found in UI components' *.xml files: