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

7.x 2.x twig:extends

Andy Truong edited this page Jan 30, 2014 · 3 revisions

Define custom filters

To provide your custom Twig filters, create @my_module/config/twig_filters.yml:

# @file: @my_module/config/twig_filters.yml
twig_filters:
  # Callback is just a function
  t: t
  # Callback is a static method
  drupalView: [\Drupal\at_base\Twig\Filters\Views, render]
  # Start the filter name with __ to let at_base know that 
  # our callback is a method on constructive class
  __at_config: [\Drupal\at_base\Twig\Filters\ATConfig, render]

Read Twig documentation for more details.

Define custom functions

It's same way for you to create custom filters, for example.

Read Twig documentation for more details.

Clone this wiki locally