0

I've installed a module and I need to get some value from frontend and pass it to a controller in my module.

is it a good practice to update in other module js files that are not created by me? and is it ok to call a controller in other module

1
  • 1
    Best practice is to override the controller by your custom module and define the sequence in module.xml, since because 3rd party extension has to be upgraded once in a while @YomnaMansour Commented Apr 2, 2019 at 12:35

1 Answer 1

0
  1. You can override that .js file in your theme and do customisations (either you can override complete file or may also create mixins)

  2. Yes you can use controller of other module but do not forget to add that module as a sequence in your custom module's module.xml https://devdocs.magento.com/guides/v2.3/extension-dev-guide/build/module-load-order.html

3
  • does mixin let me override the whole js file or only the functionlity I need to override. in other words. should I write the all file or only function I need to modify Commented Apr 3, 2019 at 12:47
  • You can override the file if you have much more customisations, I have attached the link having details about mixins. You should prefer using mixins but if it doesnt work you can override the js. Commented Apr 3, 2019 at 14:03
  • You wont be able to override the whole js file using mixins. In order to override place same file with same name in your theme folder. As if their is a file related to checkout, you need to place same js file in your theme at app/design/frontend/Vendor/Theme/Magento_Checkout/web/js/.... Commented Apr 3, 2019 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.