Browse Source

Issue #3324280 by Daniel Korte: Use TwigFilter instead of TwigFunction in hook_twig_tweak_filters_alter()

merge-requests/18/head
Daniel Korte 2 years ago committed by Chi
parent
commit
75c512a6ca
  1. 7
      twig_tweak.api.php

7
twig_tweak.api.php

@ -7,6 +7,7 @@
use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\Unicode;
use Drupal\node\NodeInterface; use Drupal\node\NodeInterface;
use Twig\TwigFilter;
use Twig\TwigFunction; use Twig\TwigFunction;
use Twig\TwigTest; use Twig\TwigTest;
@ -45,9 +46,9 @@ function hook_twig_tweak_functions_alter(array &$functions): void {
* Twig filters to alter. * Twig filters to alter.
*/ */
function hook_twig_tweak_filters_alter(array &$filters): void { function hook_twig_tweak_filters_alter(array &$filters): void {
$filters[] = new TwigFunction('str_pad', 'str_pad'); $filters[] = new TwigFilter('str_pad', 'str_pad');
$filters[] = new TwigFunction('ucfirst', [Unicode::class, 'ucfirst']); $filters[] = new TwigFilter('ucfirst', [Unicode::class, 'ucfirst']);
$filters[] = new TwigFunction('lcfirst', [Unicode::class, 'lcfirst']); $filters[] = new TwigFilter('lcfirst', [Unicode::class, 'lcfirst']);
} }
/** /**

Loading…
Cancel
Save