This repository was archived by the owner on Feb 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
7.x 2.x easy block
Andy Truong edited this page Feb 18, 2014
·
3 revisions
Blocks can be defined in yaml config style:
# %module_name/config/blocks.yml
blocks:
# Simple string definition
hello_string:
info: 'Hello String'
subject: 'Hello String'
cache: DRUPAL_CACHE_PER_ROLE
content: 'Hello Andy Truong'
# Support template rendering
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'}
# Support asset attachment
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']
# Support dynamic arguments
hello_dynamic_arguments:
info: 'Hello dynamic argument'
subject: 'Hello dynamic argument'
content:
content: '{% if node and node.status %} {{ node.title }} {% endif %}'
variables:
node: menu_get_object ___ ___________ _ _
/ _ \_ _| ___ \ | | | |
/ /_\ \| | | |_/ / __ _ ___ ___ _ __ ___ ___ __| |_ _| | ___
| _ || | | ___ \/ _` / __|/ _ \ | '_ ` _ \ / _ \ / _` | | | | |/ _ \
| | | || | | |_/ / (_| \__ \ __/_| | | | | | (_) | (_| | |_| | | __/
\_| |_/\_/ \____/ \__,_|___/\___(_)_| |_| |_|\___/ \__,_|\__,_|_|\___|
- Caching
- Twig template
- twig Service
- twig_string Service
- Recipes
- Extends
- Easy Block
- Easy Routing
- Easy Breadcrumb
- Entity Template
- Drush Commands:
- Functions:
- Misc
- Status
- Tools for Development enviroment
- /devel/php improved
- /at/sql
- /at/twig
- Kint integration