Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

7.x 2.x easy block

Andy Truong edited this page Dec 25, 2013 · 3 revisions

Easy Block — [7.x-2.x]

Blocks can be defined in yaml config style:

# %module_name/config/blocks.yml
blocks:
  hello_string:
    info: 'Hello String'
    subject: 'Hello String'
    cache: DRUPAL_CACHE_PER_ROLE
    content: 'Hello Andy Truong'
  hello_template:
    info: 'Hello template'
    subject: 'Hello template'
    cache: DRUPAL_CACHE_PER_PAGE
    content:
      template: '@module_name/templates/block/hello_template.html.twig'
      variables: {name: 'Andy Truong'}
  hello_template_string:
    info: 'Hello Template String'
    subject: 'Hello Template String'
    content:
      template_string: "{{ 'slider_front' | drupalView }}"
      attached:
        css: ['%theme/css/slider.css']
        js: ['//cdnjs.cloudflare.com/ajax/libs/jquery.cycle/3.03/jquery.cycle.all.min.js']

Clone this wiki locally