I am not cleared about field,argument and item. Also I don't know why we use it.

Xml code is:

<field name="allow_shipping_method">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Magento\Shipping\Model\Config\Source\Allmethods</item>
            <item name="config" xsi:type="array">
                <item name="formElement" xsi:type="string">multiselect</item>
                <item name="source" xsi:type="string">myform</item>
                <item name="dataScope" xsi:type="string">allow_shipping_method</item>
                <item name="label" xsi:type="string" translate="true">Allow Shipping Method</item>

I already study some articles but I am not cleared all about this.

Articles Links:https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/xml-instructions.html

Magento 2 pass argument in class from ui component

1 Answer 1


First check the example, I give you understanding by an example.

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="general" sortOrder="5">
        <field name="id" formElement="hidden">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="source" xsi:type="string">category</item>

Following are the rules for the instance configuration files:

  • The top node must have the name of one of the basic UI components.
  • The top node must contain a link to the XSD schema.

In the above example, within the top-level <form> node the <fieldset> node is nested. It declares the Fieldset UI component.

In the top node, there can be an <argument/> node. The <argument/> node contains the configuration for that basic UI component. The <argument/> node’s name attribute value must be data. The child nodes of the node will be the argument properties that will be passed in to the component.

All other child nodes are declared as items. <item name="config"> ...</item> contains the children nodes that describe the configuration of the current UI component. Please note that although configuration for all components is different, there are base properties that are mostly the same for different components. For example, we can use <item name="component">...</item> to define which JS file will be used as the Model for the Fieldset UI.

I hope this will help


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.