1

How can I override a ui_components' template file?

The concerning file is:

vendor/magento/module-ui/view/base/ui_component/templates/listing/default.xml

I want to override this file so that it adds a CSS class to the div specific for the widget used.

I've tried copying the file to: app/design/frontend/Vendor/Theme/Magento_Ui/ui_component/templates/listing/default.xhtml

But this hasn't worked, even after flushing all caches and performing setup:upgrade I don't see any changes made on the frontend.

Making the change directly in the original file under vendor does however have an effect, so I'm sure that I'm editing the right file.

Someone that has an idea?

poojan sharma
1,5561 gold badge11 silver badges16 bronze badges
asked Sep 18, 2019 at 19:26

2 Answers 2

0

The file you try to copy is an XML file, but you set it as XHTML in the copied version.

app/design/frontend/Vendor/Theme/Magento_Ui/ui_component/templates/listing/default.xhtml

that should be:

app/design/frontend/Vendor/Theme/Magento_Ui/ui_component/templates/listing/default.xml
answered Sep 19, 2019 at 19:31
0

if you know the ui_component name like "customer_listing". You can update this ui_component's template inside your_module/view/adminhtml/ui_component/customer_listing.xml:

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration. xsd">
 <argument name="data" xsi:type="array">
 <item name="template" xsi:type="string">templates/my_template</item>
 </argument>
</listing>

The 'my_template.xhtml' file will be located and copy the "default.xhtml" content into this file.

your_module/view/adminhtml/ui_component/templates/my_template.xhtml
answered Sep 20, 2019 at 0:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.