0vote

Webinar: Sellvana Theming - code samples

Manifest File

local/Opal/Dutchman/manifest.yml

modules:
    Opal_Dutchman:
        version: 0.1.0
        channel: beta
        description: Dutchman Theme by Opal

        areas:
            FCom_Admin:
                auto_use: [ views, layout ]

        default_config:
            modules/FCom_Catalog/default_image: "@Opal_Dutchman/Frontend/img/image-not-found.jpg"

        themes:
            Opal_Dutchman:
                name: Dutchman Theme by Opal
                area: FCom_Frontend
                parent: FCom_Frontend_DefaultTheme
                layout_before: Frontend/layout-before.yml
                layout_after: Frontend/layout-after.yml
                views_after: Frontend/views

Theme layout file, to be loaded BEFORE all other module layout files

local/Opal/Dutchman/Frontend/layout-before.yml

base:
    - view: head
        do:
            - [ remove, css, family=Lato ]
            - [ css, "//fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,400italic,600italic|Arvo:400,400italic" ]
            - [ css, "//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" ]
            - [ css, "@Opal_Dutchman/Frontend/css/styles.css" ]
            - [ meta, robots, "NOINDEX, NOFOLLOW" ]

Theme layout file, to be loaded AFTER all other module layout files

local/Opal/Dutchman/Frontend/layout-after.yml

/:
  - { view: root, set: { use_container: false } }

/catalog/product:
  - { view: root, set: { use_container: false } }

/checkout/cart:
  - { view: root, set: { use_container: false } }

sidebar-content:
  - { cms_block: cms-privacy-sidebar, view_name: cms-privacy-sidebar }
  - { hook: col_left, views: cms-privacy-sidebar }

static/privacy-policy:
  - { view: root, set: { col_left: true }}
  - { view: root, set: { col_right: true }}
  - { include: sidebar-content }

static/returns-policy:
  - { hook: header, clear: header }
  - { hook: footer, clear: footer }
  - { view: root, set: { col_left: true }}
  - { include: sidebar-content }

Static page template (/privacy-policy)

local/Opal/Dutchman/Frontend/views/static/privacy-policy.html.twig

<!-- { title: Privacy Policy }-->
<!-- { meta_description: Privacy policy for users }-->
<!-- { meta_keywords: privacy policy, read this }-->

Know your rights now!

Admin template for theme settings

local/Opal/Dutchman/Admin/views/settings/themes/Opal_Dutchman.html.twig

{% set * = THIS.get('model') %}
{% set fieldData = { model: *, settings_module:'Opal_Dutchman' } %}
{% import THIS.view('admin/form-elements').twigName() as forms %}

<h2>{{ "Opal Dutchman Theme Settings"|_}}</h2>
{{ forms.accordion_start({id:'settings-Opal_Dutchman'}) }}

    {{ forms.accordion_panel_start({label:'HTML'|_, id:'settings-Opal_Dutchman-group0', in:1}) }}
        {{ forms.input(fieldData, {field:'header_cta', label:'Header CTA'|_, placeholder: 'Enter your CTA text here'}) }}
    {{ forms.accordion_panel_end }}

{{ forms.accordion_end }}

Please log in or register to answer this question.

Know someone who can answer? Share a link to this

...