1

I want to be able to enable/disable the following ui_configuration fieldset via configuration conditions. Much like an ifconfig. I know I can provide a boolean item named 'disabled' in ordered to toggle the functionality. But I would like to toggle more dynamically, based on conditional logic/settings set in the admin config. Is there any way to achieve this?

  <?xml version="1.0" encoding="UTF-8"?>
    <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
        <fieldset name="foundation_catalog_remote_gallery">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Remote Images and Videos</item>
                    <item name="provider" xsi:type="string">foundation_catalog_remote_gallery.foundation_catalog_remote_gallery_data_source</item>
                    <item name="dataScope" xsi:type="string">data.product</item>
                    <item name="sortOrder" xsi:type="number">23</item>
                    <item name="collapsible" xsi:type="boolean">true</item>
                    <item name="opened" xsi:type="boolean">false</item>
                    <item name="ns" xsi:type="string">product_form</item>
                     <item name="disabled" xsi:type="string">${ $.provider }:data.disabled</item>
                </item>
            </argument>
            <argument name="dataProvider" xsi:type="configurableObject">
                <argument name="class" xsi:type="string">Foundation\Catalog\Ui\DataProvider\RemoteGalleryDataProvider</argument>
                <argument name="name" xsi:type="string">sccfoundation_catalog_remote_gallery_data_source</argument>
                <argument name="primaryFieldName" xsi:type="string">entity_id</argument>
                <argument name="requestFieldName" xsi:type="string">id</argument>
            </argument>
            <container name="remote_image_and_video_group">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="sortOrder" xsi:type="number">1</item>
                    </item>
                </argument>
                <htmlContent name="html_content">
                    <argument name="block" xsi:type="object">Foundation\Catalog\Block\Adminhtml\Product\Edit\Tab\RemoteImages</argument>
                </htmlContent>
            </container>
        </fieldset>
    </form>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.