Magento 2
Argument Substitution
Free Preview
vendor/magento/module-inventory/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!--
    The "name" attribute is the class containing the argument you wish to substitute.
    -->
    <type name="Magento\Inventory\Model\SourceItem\Validator\StatusValidator">
        <!--
        The "arguments" node targets the arguments of this class.
        -->
        <arguments>
            <!--
            Each "argument" child node has a "name" attribute. This example references
            the $allowedSourceItemStatuses PHP variable. You must also define the
            variable type with the "xsi:type" attribute: string, array, boolean, etc.
            -->
            <argument name="allowedSourceItemStatuses" xsi:type="array">
                <!--
                Since XML files & nodes are all merged into one giant tree structure,
                the following items are pushed onto the end of the
                $allowedSourceItemStatuses variable array stack.

                This "item" must define the variable type for this individual array
                element. The "name" is the array element index name, and the value of
                the node can be any static variable or value.
                -->
                <item xsi:type="const" name="in_stock">Magento\InventoryApi\Api\Data\SourceItemInterface::STATUS_IN_STOCK</item>
                <item xsi:type="const" name="out_of_stock">Magento\InventoryApi\Api\Data\SourceItemInterface::STATUS_OUT_OF_STOCK</item>
            </argument>
        </arguments>
    </type>
</config>
Want to learn more?

Visit M.academy to learn much more about Magento, Laravel, PHP, Javascript, & Docker.

M.academy logo