I want to have a field in my UI Component form and a "Select Product…" Button where I can choose a product and it gets inserted into the input.
Similar to the "Catalog Product Link" Widget.
Started by adding this to my ui_component form.xml but without desired result:
<fieldset name="assign_products" sortOrder="40">
<settings>
<collapsible>true</collapsible>
<label translate="true">Products</label>
</settings>
<container name="assign_products_container" sortOrder="160">
<htmlContent name="html_content">
<block name="my_assigned_products" class="Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser">
<arguments>
<argument name="button" xsi:type="array">
<item name="open" xsi:type="string" translate="true">Select Product...</item>
</argument>
</arguments>
</block>
</htmlContent>
</container>
</fieldset>
Any tips?
Best Answer
You can"t use widget block in uiform. It will not work, because it rendering differently as in widget form. But you can use this functionality creating form extending Magento\Backend\Block\Widget\Form\Generic But it is deprecated
Example