0
votes

I would like to print a block region inside a layout file. However the layout template doesnt have access to the 'page' variable. So I cannot do:

{{ page.regionname }} 

Is there any code to print block regions? Oooor how can I get the page variable in one of my layouts? The layout and template file is defined in my yml file as follows:

services_overview:
  label: services - Overview
  category: ssld Layouts
  template: templates/layouts/ssld-hs-overview
  regions:
    sidebar_left:
      label: Sidebar Left
    right:
      label: Right
    left:
      label: Left
    middle:
      label: Middle

(It might be worth mentioning that I'm not too familiar with twig. This is the first time I work with Drupal 8)

1

1 Answers

0
votes

You can print the regions in page.html.twig file as {{page.sidebar_left}}. Your your_theme.info.yml file should look something like this

name: Bartik
type: theme
base theme: classy
description: 'A flexible, recolorable theme with many regions and a responsive, mobile-first layout.'
package: Core
version: VERSION
core: 8.x
libraries:
  - bartik/global-styling
regions:
  sidebar_left: 'Sidebar Left'
  right: 'Right'
  left: Left
  content: Content
  middle: 'Middle'

Above is a sample from bartik theme info file. A.F.A.I.K content region is mandatory