How to override form in magento 2 (uiComponent)

754 Views Asked by At

I have form declared as uiComponent(custom module). I have to disable top menu button based on some status. The button is in structure

<form>
<argument name="data" xsi:type="array">
 <item name="buttons" xsi:type="array">
            <item name="save_and_continue" xsi:type="array">
                <item name="name" xsi:type="string">save_and_continue</item>
                <item name="label" xsi:type="string" translate="true">Save and Continue Edit</item>
                <item name="class" xsi:type="string">save_and_continue</item>
            </item>
....
</item>
....
</form>

I try to create observer to remove element from view but using $layout->unsetElement('save_and_continue') not work. I found that there is some think like PHP modifiers in UI components but i cant get this right from tutorial provided in doc.

How can i remove remove such item ? It can`t be static xml to override this one because i have some dynamic parameters.

1

There are 1 best solutions below

0
user2217288 On

I end up doing is to override with my own class.

<item name="save_and_continue" xsi:type="string">
  class\namespace....
</item>