3 namespace Drupal\{{ machine_name }};
8 class {{ class }} extends \Twig_Extension {
13 public function getName() {
14 return '{{ machine_name }}';
20 public function getFunctions() {
22 new \Twig_SimpleFunction('foo', function ($argument = NULL) {
23 return 'Foo: ' . $argument;
31 public function getFilters() {
33 new \Twig_SimpleFilter('bar', function ($text) {
34 return str_replace('bar', 'BAR', $text);
42 public function getTests() {
44 new \Twig_SimpleTest('color', function ($text) {
45 return preg_match('/^#(?:[0-9a-f]{3}){1,2}$/i', $text);