【问题标题】:Where is this module-ui/view/base/web/templates/form/element/input.html used?这个module-ui/view/base/web/templates/form/element/input.html用在什么地方?
【发布时间】:2022-12-19 15:15:35
【问题描述】:
我基本上浏览了 RequireJS section of the official Magento 2 文档,其中有一节提到如何将带有 class="admin__control-text" 的输入标签的最大长度更改为 512,默认情况下应该是 256。
我很难找到它在 Magento 2 中的使用位置。即使打开了模板提示,我也无法在 adminhtml 或前端区域中找到正在应用该文件的表单输入。我试着检查 adminhtml 区域,在某些地方可以看到类“admin__control-text”,但是它们来自其他模板,而不是 vendor/magento/module_ui 中的这个模板。
因此,即使在创建文件后,我也无法检查和确认我在 app/code/<Vendor_name>/<module_name>/view/base/web/template/form/element 中对最大长度所做的添加是否正在应用,因为我不知道在哪里检查以及是否正在应用此文件。
有人可以帮忙吗?我已经坚持了很长一段时间。
【问题讨论】:
标签:
html
magento
requirejs
magento2
【解决方案1】:
您是否创建了模块所需的其他文件以便正常工作并正确添加到 Magento2,例如 requirejs-config.js、registration.php 和 module.xml?
var config = {
map: {
'*': {
'ui/template/form/element/input': '<Vendor_name>_<module_name>/template/form/element/input'
}
}
};
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'<Vendor_name>_<module_name>',
__DIR__
);
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="<Vendor_name>_<module_name>" setup_version="1.0.0">
<sequence>
<module name="Magento_Ui" />
<module name="Magento_Backend" />
</sequence>
</module>
</config>