You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Sometimes, the check for a feature is required only to display or not some elements in a template. So if more than one controller renders the same template, I need to set the same boolean variable in every controller.
Describe the solution you'd like
I'd like to have some twig function or test to check if the feature is enabled without modifying the controller code.
Describe alternatives you've considered
I'd like to have a twig extension providing one function:
{# the second and third parameters are optional #}
{% if is_feature_enabled('feature_name', 'id', {payload_item1: payload_item_value1, payload_item2: payload_item_value2}) %}
{% endif %}
Hello @ajgarlag, thanks for your question. I really like it. It would be a nice improvement for the developer experience in any app involving twig templates.
I think the only drawback for a possible implementation is to take care of adding the extension only when Twig is available in the Symfony container. Twig isn't a library requirement, so, we can set it as a dev dependency. This way we can have the twig extension when twig is enabled. Also, continue working on applications that don't use the Twig engine.
If you have questions, don't hesitate to ask, I'll be happy to answer any question and help in any doubt. Thanks for contributing, and Welcome to our Community.
Is your feature request related to a problem? Please describe.
Sometimes, the check for a feature is required only to display or not some elements in a template. So if more than one controller renders the same template, I need to set the same boolean variable in every controller.
Describe the solution you'd like
I'd like to have some twig function or test to check if the feature is enabled without modifying the controller code.
Describe alternatives you've considered
I'd like to have a twig extension providing one function:
and two tests:
Additional context
Would you accept a PR implementing this?
The text was updated successfully, but these errors were encountered: