pattern-lab/drupal-twig-extensions

Twig Extensions for working with Drupal

v0.2.0 2018-02-07 03:22 UTC

This package is auto-updated.

Last update: 2021-01-06 04:57:07 UTC


README

composer require pattern-lab/drupal-twig-extensions

How to use

  • Ensure your Twig Pattern Engine is v2.2.0 +
  • Install this via composer
  • Add this to config.yml:
twigExtensions:
    - '\PatternLab\DrupalTwigExtensions\Basic'

Motivation

This allows Twig templates that are used in both Pattern Lab and Drupal environments to function correctly. Many times this is simply providing the function so the templates can work. In Drupal if {{ my_var | t }} is seen, then my_var is then marked as translatable; so all we need to do in Pattern Lab is well, nothing. We just take the variable and let it pass right through.

Twig Functionality Provided

Filters

  • t
  • render
  • placeholder
  • without

Functions

  • url
  • path
  • link