diff --git a/src/guides/v2.3/javascript-dev-guide/javascript/requirejs.md b/src/guides/v2.3/javascript-dev-guide/javascript/requirejs.md index 4ec97bd15c3..0d632cbe6f5 100644 --- a/src/guides/v2.3/javascript-dev-guide/javascript/requirejs.md +++ b/src/guides/v2.3/javascript-dev-guide/javascript/requirejs.md @@ -62,6 +62,38 @@ paths: { } ``` +Consider the example of overwriting an HTML file in the adminhtml. +In this example, the `max-length` value of the text-box in the `adminhtml` is altered. The HTML file is located at `vendor/magento/module_ui/view/base/web/templates/form/element/input.html`. + +1. Create a `requirejs-config.js` file under `app/code///view/base/` and add the following code: + + ```javascript + var config = { + paths: { + 'ui/template/form/element/input': '_/template/form/element/input' + } + }; + ``` + +1. Create an `input.html` file under `app/code///view/base/web/template/form/` and copy the contents of the `input.html` file from the `module_ui` template file. +1. Change the maxlength value to `512`, which was originally set to `256`. +1. Upgrade the Magento application: + + ```bash + bin/magento setup:upgrade + ``` + +1. Generate the dependency injection configuration: + + ```bash + bin/magento setup:di:compile + ``` + +1. Confirm the modification by inspecting the element source code and check the `maxlength` value, which should be `512` as specified in the template. + +{:.bs-callout-info} +The path for `Magento_Ui/templates` is set to be `ui/template` in the `requirejs-config.js` module of `module_ui`, hence `ui/template` is used for specifying the path. If no paths are set, `/templates` should be used. + ### deps {#requirejs-config-deps} The `deps` configuration is used to add a dependency. It can either be used directly under `var config = {}` or under a [shim configuration](#requirejs-config-shim). Adding modules under an independent `deps` configuration will load the specified modules in all pages.