cancel
Showing results for 
Search instead for 
Did you mean: 

Overwriting UI elements in Module with requirejs-config.js

SOLVED

Overwriting UI elements in Module with requirejs-config.js

I'm trying to overwrite the necessary UI elements in my module. I for the input fields I need to have the label behind the input.

Now I know how to overwrite these in my theme but I would like to add them to my module to make it easier to install for future projects.

I know that this should be done with the requirejs-config.js but i'm unsure how.

 

var config = {
config: {
    mixins: {
        'Magento_Checkout/js/view/shipping': {
            'BB_Checkout/js/mixin/shipping-mixin': true
        }
    }
},
map: {
    '*': {
        'Magento_Ui/view/frontend/web/templates/form/element/input.html': 'BB_Checkout/view/frontend/web/templates/form/element/input.html',
        'Magento_Ui/view/frontend/web/templates/form/element/email.html': 'BB_Checkout/view/frontend/web/templates/form/element/email.html',
        'Magento_Ui/view/frontend/web/templates/form/element/password.html': 'BB_Checkout/view/frontend/web/templates/form/element/password.html',
        'Magento_Ui/view/frontend/web/templates/form/field.html': 'BB_Checkout/view/frontend/web/templates/form/field.html'
    }
}
 };

 

I currently got this but the part from map: doesn't work. Any idea how I would get this to work? I tried Magento cache cleaning and browser cache cleaning already.

 

I also tried this:

 

 map: {
    '*': {
        'Magento_Ui/templates/form/element/input.html': 'BB_Checkout/templates/form/element/input.html',
        'Magento_Ui/templates/form/element/email.html': 'BB_Checkout/templates/form/element/email.html',
        'Magento_Ui/templates/form/element/password.html': 'BB_Checkout/templates/form/element/password.html',
        'Magento_Ui/templates/form/field.html': '/BB_Checkout/templates/form/field.html'
    }
}

 I also tried:

 

 map: {
    '*': {
        'Magento_Ui/templates/form/element/input.html': 'templates/form/element/input.html',
        'Magento_Ui/templates/form/element/email.html': 'templates/form/element/email.html',
        'Magento_Ui/templates/form/element/password.html': 'templates/form/element/password.html',
        'Magento_Ui/templates/form/field.html': 'templates/form/field.html'
    }
}

Thanks in advance.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Overwriting UI elements in Module with requirejs-config.js

Ah apparently Magento_Ui/templates is mapped to ui/template in Magento\vendor\magento\module-ui\view\base\requirejs-config.js

 

So after adding ui/template it works.

View solution in original post

1 REPLY 1

Re: Overwriting UI elements in Module with requirejs-config.js

Ah apparently Magento_Ui/templates is mapped to ui/template in Magento\vendor\magento\module-ui\view\base\requirejs-config.js

 

So after adding ui/template it works.