Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/inline twig #112

Merged
merged 2 commits into from
Jun 4, 2024
Merged

Feat/inline twig #112

merged 2 commits into from
Jun 4, 2024

Conversation

gwillz
Copy link
Collaborator

@gwillz gwillz commented Apr 5, 2024

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 ]);

@gwillz gwillz merged commit 6245042 into master Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants