Reading list Switch to dark mode

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

    Updated 4 March 2024

    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,

    Exception

    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.

    Searching for an experienced
    Magento 2 Company ?
    Find out More

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

    Happy coding 👨 💻

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    4 comments

  • Roman
    • Sanjay Chouhan (Moderator)
  • Igor
    • Sanjay Chouhan (Moderator)
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home