@wondrousllc/fractal-twig-drupal-adapter
Advanced tools
Weekly downloads
Readme
An adapter to let you use Twig templates with Fractal.
$ npm install --save @wondrousllc/fractal-twig-drupal-adapter
in your fractal.js
const fractal = require('@frctl/fractal').create();
const twigAdapter = require('@wondrousllc/fractal-twig-drupal-adapter');
const twig = twigAdapter({
handlePrefix: '@components/',
});
fractal.components.engine(twig);
fractal.components.set('ext', '.twig');
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.
You have the ability to extend Twig with custom filters by adding any filter functions to the twigAdapter configuration. The name of the function will be used as the filter name. For example, to create a |render
filter:
const twig = twigAdapter({
filters: {
render(str) {
return str;
}
}
});
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 translate tag.
FAQs
Twig template adapter for Fractal with Drupal 8 directives.
The npm package @wondrousllc/fractal-twig-drupal-adapter receives a total of 148 weekly downloads. As such, @wondrousllc/fractal-twig-drupal-adapter popularity was classified as not popular.
We found that @wondrousllc/fractal-twig-drupal-adapter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.