Conversation
dd21e1d to
9f6b0f8
Compare
|
What is the use case for having this in Twig templates ? And this looks like a good candidate for a Twig test instead, exposing an API like |
My use case is when I want to display http response content, if content is a valid json a CSS class is applied
Good point Twig test is a better choice for this, I will update the PR |
|
I'm not sure this use case is common enough to ship that in Twig itself. I will let @fabpot give his opinion on this too. However, this does not prevent registering a Twig test in your own project needing this. |
Of course it's just a proposal :) |
src/Extension/CoreExtension.php
Outdated
Co-authored-by: Hugo Alliaume <hugo@alliau.me>
|
I don't think it should be part of core. |
Add is valid json Twig test using json_validate PHP function