I have added one new mass action in sales order grid using UI component, I want to show mass action only if store configuration value set to yes.
If store configuration value set to No, then my custom mass action should not display.
we are able to add mass action in the sales order grid by creating the following files in your module:
view/adminhtml/ui_component/sales_order_grid.xml
With the following:
\view\adminhtml\ui_component\sales_order_grid.xml
<?xml version="1.0" encoding="UTF-8"?> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <listingToolbar name="listing_top"> <massaction name="listing_massaction"> <action name="order_delete"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="type" xsi:type="string">custom_option</item> <item name="label" xsi:type="string" translate="true">Delete</item> <item name="url" xsi:type="url" path="ordercustom/order/massaction"/> <item name="confirm" xsi:type="array"> <item name="title" xsi:type="string" translate="true">Custom Action(s)</item> <item name="message" xsi:type="string" translate="true">Are you sure you wan\'t to delete selected items?</item> </item> </item> </argument> </action> </massaction> </listingToolbar> </listing>
Note: If you will define your action under tag , then new mass action will be added as child mass action.
Solution:
You can override its parser through di.xml file and add that file in your module and add the Module's enable and disable code there. Using this you can enable your mass action on behalf of store config setting.