Menu Close
    Hire us Request quote Reading list Switch to dark mode

    “Class argument is invalid:” issue in Magento 2.3.3 on Admin Grid

    In the new release of Magento 2.3.3, we are getting a new issue when opening some admin grids. This issue is coming from the Mass-actions which have sub-options. You will find an exception like “Class argument is invalid: Webkul\ModuleName\Ui\Component\MassAction\StatusOptions” as shown below,

    In earlier Magento versions that means versions prior to the Magento 2.3.3 in UI component XML file, we used below syntax to create Mass-actions with Sub-options,

    <action name="change_status">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="type" xsi:type="string">change_status</item>
                <item name="label" xsi:type="string" translate="true">Change Status</item>
            </item>
        </argument>
        <argument name="actions" xsi:type="configurableObject">
            <argument name="class" xsi:type="string">Webkul\GiftCard\Ui\Component\MassAction\Badge\Assignoptions</argument>
            <argument name="data" xsi:type="array">
                <item name="urlPath" xsi:type="string">giftcard/giftuser/changestatus</item>
                <item name="paramName" xsi:type="string">entity_id</item>
                <item name="confirm" xsi:type="array">
                    <item name="title" xsi:type="string" translate="true">Change Status</item>
                    <item name="message" xsi:type="string" translate="true">Are you sure?</item>
                </item>
            </argument>
        </argument>
    </action>

    So now let’s see what changes do we need to make to make it work. Instead of the above code we will have to write below code in the UI component XML file,

    <action name="change_status">
        <settings>
            <type>change_status</type>
            <label translate="true">Change Status</label>
            <actions class="Webkul\GiftCard\Ui\Component\MassAction\Badge\Assignoptions"/>
        </settings>
    </action>

    Now we need to add few more lines in the etc/di.xml file as below,

    <type name="Webkul\GiftCard\Ui\Component\MassAction\Badge\Assignoptions">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="urlPath" xsi:type="string">giftcard/giftuser/changestatus</item>
                <item name="paramName" xsi:type="string">entity_id</item>
                <item name="confirm" xsi:type="array">
                    <item name="title" xsi:type="string" translatable="true">Change Status</item>
                    <item name="message" xsi:type="string" translatable="true">Are you sure?</item>
                </item>
            </argument>
        </arguments>
    </type>

    Now run the di compile command and it should work as expected.

    Thank you for reading the blog. Feel free to comment if you face any issue.

    Happy coding 👨 💻

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close