Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Example needed on how to overwrite a knockoutjs .html template file in requirejs-config.js by using paths #7955

Closed
@Eddcapone

Description

@Eddcapone

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:

image

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.

Metadata

Metadata

Assignees

Labels

2.4.xMagento 2.4.x related changesProgress: doneTechnicalUpdates to the code or processes that alter the technical content of the doc

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions