Example needed on how to overwrite a knockoutjs .html template file in requirejs-config.js by using paths #7955
Description
General issue
Feedback on page: /guides/v2.4/javascript-dev-guide/javascript/requirejs.html
Description:
I tried to apply the information provided in the documentation to change the template Magento_Ui/view/base/web/templates/form/element/input with my own in app\code\Company\Base\view\adminhtml\web\template\form\element\input.html because I need to change the value of maxlength
, but it does miss a real example and so I failed.
The template is used for the input text fields in the admin backend:
So I tried this app\code\Company\Base\view\adminhtml\web\requirejs-config.js:
var config = {
paths: {
'ui/form/element/input': 'Company_Base/template/form/element/input',
'Magento_Ui/form/element/input': 'Company_Base/form/element/input',
}
};
But it still loads the original template which you can see by inspecting the element source code and look at the maxlength value still being 255 instead of 512 like in my template.
I tried paths
because in the documentation it says:
The paths configuration, similar to map, is used for aliasing not just any real AMD module that calls define(), but also any JS file (even from a URL), HTML templates, etc. Magento uses this to alias URLs and third party libraries.
Possible solutions:
Please provide more information and maybe a real world example, to show how to use it, since it does not seem to work.