7

Based on my preliminary research, you can use a Magento 2 theme to

  1. Add additional, or replace already defined, translation strings for Magento’s __ localization function
  2. Specify the height and width for named Magento image assets
  3. Replace any front end asset files added by a Magento module
  4. Replace any email template file
  5. Add files for Magento’s //@magento_import LessCSS directive to consume
  6. Add additional layout handle XML files to merge when Magento merges a specific module’s layout handle XML
  7. Override a module’s layout handle XML file (edited)

Is there anything else you change change about Magento's system behavior via a theme?

  • that is good question.. i am waiting for answer also :) – Amit Bera Mar 31 '17 at 18:20
3

RequireJS dependencies and paths can be defined in the theme's requirejs-config.js file

  • Nice, thank you. I did not know/remember that one. – Alan Storm Mar 31 '17 at 21:07
  • ^ Thats somehow ironic.. I guess to remember to see it in one of your posts :) – Max Apr 2 '17 at 4:00
3

Besides overriding content, themes can also contribute template files and JS. For example you can put a template file into {theme}/Magento_Theme/templates/template.phtml and use it in a layout xml like you would any other template, i.e. <block class="Magento\Framework\View\Element\Template" template="Magento_Theme::template.phtml">.

JS files can be placed in {theme}/web/js/script.js and be referenced like <div data-mage-init='{"js/script":{}}'>.

2

I think you have most of it covered, some details that might be good to note:

Re: 2. In view.xml you can also alter the images in various ways. For example, you can include/ exclude extra white space in images, disregard transparancy, or replace transparency with a background color. You can also change the layout and features of the product page image gallery.

Re: 3. Maybe it’s implied, but you can also override any 3rd party modules, not only Magento core modules.

Themes also defines a parent theme to inherit from.

0

Edit default widgets options for backend in frontend theme with widget.xml

here an example i use it to add templates for magento default widgets

  • are you sure Magento 2 themes support this, or are you just speculating? I don't see any widget.xml files in the core code. – Alan Storm Apr 10 '17 at 19:35
  • here an example i use it to add templates for magento default widgets – Mostafa Sakr Jul 24 '17 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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