Module Description
Add a simple plugin system to add new twig extensions (Filter and Functions). Provides a new service provider for "twig.extensions" to add new plugins.

Versions Drupal 8.2 or lower: Use Twig Extender 8.1 Drupal 8.3 or higher: Use Twig Extender 8.2

Documentation Basic filter and functions: https://github.com/b-connect/twig_extender Extra filter and function: https://github.com/b-connect/twig_extender/tree/8.x-2.x/modules/twig_ext...

Add new functions and filters Please add your suggestions here. https://www.drupal.org/node/2701695

Simple Plugin <?php namespace Drupal\twig_extender\Plugin\TwigPlugin; use Drupal\twig_extender\Plugin\Twig\TwigPluginBase; use Drupal\Component\Utility\Unicode; /** * Example plugin Hello World. * * @TwigPlugin( * id = "twig_extender_hello", * label = @Translation("Hello world plugin"), * type = "function", * name = "hello", * function = "hello" * ) */ class HelloWorld extends TwigPluginBase { /** * Implement hello world function. */ public function hello() { return 'Hello World'; } } Using in Template

{% hello() %} More will follow.

Sponsored by http://www.b-connect.de

Project Usage
1435
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
DEV
Module Summary
This module aims to solve the need for a simple plugin system to add new twig extensions (Filter and Functions) in Drupal, providing a new service provider for 'twig.extensions' to add new plugins.
Data Name
twig_extender

OPENAI CHATBOT

OPENAI CHATBOT

14:28:39
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.