Is there any option to override magento-ui vendor/magento/module-ui/view/base/web/templates templates from a theme?
Other module's templates overriding works fine:
var config = {
 map: {
 '*': {
 'Magento_Checkout/template/estimation.html': 'template/module-checkout/estimation.html',
 'Magento_Checkout/template/progress-bar.html': 'template/module-checkout/progress-bar.html'
 }
 }
};
But I see that module-ui templates' path is declared this way:
var config = {
 paths: {
 'ui/template': 'Magento_Ui/templates'
 }
}
And I can't override this file:
vendor/magento/module-ui/view/base/web/templates/form/element/textarea.html
- 
 Have you did it?Dhaduk Mitesh– Dhaduk Mitesh2019年03月27日 06:41:02 +00:00Commented Mar 27, 2019 at 6:41
- 
 But not work for me. What you write in 'requirejs-config.js'?Dhaduk Mitesh– Dhaduk Mitesh2019年03月27日 10:52:29 +00:00Commented Mar 27, 2019 at 10:52
- 
 Where you want to override? In a module or in a theme?Arthanis– Arthanis2019年03月27日 13:14:17 +00:00Commented Mar 27, 2019 at 13:14
- 
 In a module....Dhaduk Mitesh– Dhaduk Mitesh2019年03月27日 13:22:25 +00:00Commented Mar 27, 2019 at 13:22
2 Answers 2
Did you try to create in your theme a Magento_Ui/web/templates/form/element/textarea.html file ? This should override the base one , also don't forget to remove the theme files from pub/static/, this worked for me
Or in your custom module , create a [Namespace]/[Module]/view/frontend/requirejs-config.js file in your module with the following code
var config = {
 map: {
 '*': {
 'Magento_Checkout/template/estimation.html': '[Namespace]_[Module]/template/module-checkout/estimation.html',
 'Magento_Checkout/template/progress-bar.html': '[Namespace]_[Module]/template/module-checkout/progress-bar.html'
 }
 }
};
- 
 Creating the exact path works, but the requirejs-config.js does not with Magento_Ui... I tried everything possible... If someone knows how to do it...Pol Ravalitera– Pol Ravalitera2017年08月03日 14:02:06 +00:00Commented Aug 3, 2017 at 14:02
- 
 @PolRavalitera What exactly do you want to do?Vlad Patru– Vlad Patru2017年08月04日 10:18:02 +00:00Commented Aug 4, 2017 at 10:18
- 
 @VladPetru I want to rewrite form/field.html from the requirejs-config.js , in order to put my new field.html in a module. I cleaned cache, everything, that just do not work on 2.1.7. The exact path in theme worsk (Magento_Ui etc).Pol Ravalitera– Pol Ravalitera2017年08月04日 12:57:31 +00:00Commented Aug 4, 2017 at 12:57
- 
 @PolRavalitera I just tried to override that exact file, it is working but be carefull, the requirejs-config file doesn't always update after one refresh, if the cache is done for some files it leaves them like they are. You should clear magento2 cache and browser cache, if its not working manualy delete the file from pub/static/frontend/[Namespace]/[Theme]/[lang_code]/Magento_Ui/templates/form/Vlad Patru– Vlad Patru2017年08月08日 08:56:02 +00:00Commented Aug 8, 2017 at 8:56
- 
 @VlaPatru I just add a lot of problem on that, i had to delete static/frontend/_requirejs . I don't know why, but the "secure" version of it is not updated... So i thought maybe that was just that last time with this problem. I will retry. Thx you for looking into it !!!Pol Ravalitera– Pol Ravalitera2017年08月09日 07:53:54 +00:00Commented Aug 9, 2017 at 7:53
Create requirejs-config.js file from [Namespace]/[Module]/view/base.
So path will be [Namespace]/[Module]/view/base/requirejs-config.js
 var config = {
 map: {
 '*': {
 'Magento_Checkout/template/estimation.html': '[Namespace]_[Module]/template/module-checkout/estimation.html',
 'Magento_Checkout/template/progress-bar.html': '[Namespace]_[Module]/template/module-checkout/progress-bar.html'
 }
 }
 };
and run the commands
php bin/magento cache:flush
php bin/magento cache:clean
then you can check [root]/[pub]/[static]/[_requirejs]/[frontend]/[Namespace]/[theme]/[en_US]/requirejs-config.js your code will update here.
So it will work. feel free to ask if you have any queries?
- 
 How can I override file-uploader.js from module-ui under web/js/form/element ? I did try as you suggested but not working.anonymous– anonymous2019年02月04日 06:22:07 +00:00Commented Feb 4, 2019 at 6:22
Explore related questions
See similar questions with these tags.