Package detail

twig-drupal-filters

kalamuna77.9kMIT3.2.0

Drupal's Twig filters, implemented for Twig.js

Drupal, Twig

readme

Twig.js Drupal Extensions

Greenkeeper badge Build Status

Twig.js implementations of Drupal's Twig functions and filters. Most of these are just stubbed creations from John Albin's work in KSS-Node.

Usage

var Twig = require('twig')
var twigDrupal = require('twig-drupal-filters')

// Add the filters to Drupal.
twigDrupal(Twig);
{{ 'Hello World!'|clean_id }}

Filters

A comprehensive list of the filters is available here.

  • t
  • trans
  • placeholder
  • without
  • clean_class
  • clean_id
  • render
  • path
  • url
  • format_date
  • drupal_escape
  • safe_join

Functions

  • link
  • active_theme*
  • attach_library*

*These are dummy functions that don't do anything except keep Twig.js compilation from breaking when these Drupal-specific functions are used in Drupal Twig templates.

changelog

Change Log

3.2.0 - 2202-10-28

3.1.2 - 2020-05-26

  • Switch to object-keys for retrieving the object keys in |without
  • Clean up null input of without

3.1.1 - 2020-03-24

  • Fix cleanid() with invalid args

3.1.0 - 2020-03-04

  • Update dependencies

3.0.0 - 2020-02-19

2.0.0 - 2018-06-21

  • Removed the |link() filter
    • Use link() function instead
  • Updated dependencies

1.1.0

  • Added link() function

1.0.0

  • Fix default seperator for slugg
  • Updating coding standards

0.2.2

  • Fix invalid parameters for slugg

0.2.1

  • Removed slugify dependency

0.2.0

  • Switched from slug to slugg to simplify dependencies