PART 1.1.2 – Fallback and theme inheritance

Theme structure at a glance:

 

Magento 2 compared to Magento 1 only has one folder for all theme files. 

Magento 1

app/design

skin

layout

css

template

images

locale

js

Magento 2

Vendor/themename (or vendor/vaimo/theme-name)

Vendor_Modules (eg Magento_Catalog)

etc

web

i18n

theme.xml

registration.php

Fallback

is defined in theme.xml. Theme xml is used by Magento to recognise the theme. 

theme.xml

1

2

3

4

5

6

7

<theme xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“urn:magento:framework:Config/etc/theme.xsd”>

    <title>Frontend Workshop</title> <!– your theme’s name –>

    <parent>Magento/blank</parent> <!– the parent theme, in case your theme inherits from an existing theme –>

    <media>

        <preview_image>media/preview.jpg</preview_image> <!– the path to your theme’s preview image –>

    </media>

</theme>

 

Important difference compared to M1 – Layout files are merged! 

There is no local.xml in themes in M2. In some cases layout files need to be overridden, this can be done by adding an override folder inside layout

 

Files in web or templates are not merged. 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s