An adapter to let you use Twig templates with Fractal.
$ npm install --save @wondrousllc/fractal-twig-drupal-adapterin your fractal.js
const fractal = require('@frctl/fractal').create(); const twigAdapter = require('@wondrousllc/fractal-twig-drupal-adapter'); const twig = twigAdapter({ handlePrefix: '@components/', });This adapter allows you to use some drupal filters, functions and tags.
|t - The Drupal core translation filter. Additional parameters not supported, yet.
|field_value - Provided by the module drupal/twig_field_value to use plain outputs from a field.
path() - The Drupal core path function.
url() - The Drupal core url function.
block_view() - Provided by the module drupal/twig_extender to directly print a block.
{% trans %} - The Drupal core translat tag.