I am basically going through the RequireJS section of the official Magento 2 documentation and there is a section which mentions about changing the maxlength of an input tag with to 512, which is supposed to be 256 by default.
I am facing difficulty locating where this is being used in Magento 2. Even with the template hints turned on, I am not able to find which form input in the adminhtml or frontend areas is this file is getting applied. I tried checking the adminhtml area and could see the class "admin__control-text" in some places however they came from some other template and not this one which is inside vendor/magento/module_ui
.
So even after creating the file I am not able to check and confirm if the additions that I made in my app/code/<Vendor_name>/<module_name>/view/base/web/template/form/element
to the maxlength are being applied as I don't know where to check and if this file is getting applied.
Can someone please help with this? I have been stuck on this for quite some time.
CodePudding user response:
Did you create the other files needed to you module in order to work and add correctly to Magento2, like requirejs-config.js
, registration.php
and module.xml
?
var config = {
map: {
'*': {
'ui/template/form/element/input': '<Vendor_name>_<module_name>/template/form/element/input'
}
}
};
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::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>