- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update adminhtml ui component
Hi, I want to add some words into the following template vendor/magento/module-ui/view/base/web/templates/form/element/uploader/image.html
But I don't want it to be effective on each image uploader from my website but only on the ui element i am working on.
<field name="imageUploader_0"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">string</item> <item name="label" xsi:type="string" translate="true">Image 1</item> <item name="visible" xsi:type="boolean">true</item> <item name="formElement" xsi:type="string">imageUploader</item> <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item> <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item> <item name="uploaderConfig" xsi:type="array"> <item name="url" xsi:type="url" path="plp/plp/imageupload"/> </item> </item> </argument> </field>
From what I understand, the following conf item is the one that define the use of the template <item name="formElement" xsi:type="string">imageUploader</item>
And that element is defined itself in vendor/magento/module-ui/view/base/ui_component/etc/definition.xml
<imageUploader class="Magento\Ui\Component\Form\Element\DataType\Media\Image"
component="Magento_Ui/js/form/element/image-uploader"
template="ui/form/element/uploader/image">
So what I think I have to do is replace the imageUploader use in my component by something like imageUploaderCustom which would be the same as this one but with a different template.
Problem is : I don't know how to add a new element in that definition.xml
Is there a way to extend it to create my new element ? If not is there an other way to do what I want ?
Thanks for your assistance !