Skip to content
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 opened this issue Sep 30, 2020 · 2 comments · Fixed by #8367
Assignees
Labels
2.4.x Magento 2.4.x related changes Progress: done Technical Updates to the code or processes that alter the technical content of the doc

Comments

@Eddcapone
Copy link

Eddcapone commented Sep 30, 2020

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.

@m2-assistant
Copy link

m2-assistant bot commented Sep 30, 2020

Hi @Eddcapone. Thank you for your report.
To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


@jcalcaben jcalcaben added 2.4.x Magento 2.4.x related changes Help Wanted Help wanted for issue/PR Technical Updates to the code or processes that alter the technical content of the doc labels Oct 1, 2020
@jcalcaben jcalcaben self-assigned this Oct 1, 2020
@jcalcaben jcalcaben assigned bdenham and unassigned jcalcaben Oct 1, 2020
@bdenham bdenham removed their assignment Oct 29, 2020
@sathiyaaa
Copy link
Contributor

@magento I am working on this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2.4.x Magento 2.4.x related changes Progress: done Technical Updates to the code or processes that alter the technical content of the doc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants