Closed gwillz closed 3 months ago
Twig string templates. Handy things.
These are something you can hand to (admin) users to do little snippets of logic from a content managed environment.
Use it something like:
$items = [ ['name' => 'abc'], ['bad'], ['name' => 'def'], ]; $template = '{{ items|map(item => item.name ?? false)|filter|join(', ') }}'; $html = TwigView::renderString($template, [ 'items' => $items ]);
Twig string templates. Handy things.
These are something you can hand to (admin) users to do little snippets of logic from a content managed environment.
Use it something like: