I need to display an image in twig
based on a value that comes from controller. For example there in an image of a home that should appear if the value coming from the controller is (Home or home or renovation or Renovation or rent or Rent) and the list goes on.
At the moment what is am doing is as following
{% if goal == "house" or goals == "House" or goal == "home" or goals == "Home" %}
<img src="{{ asset('bundles/bundlename/images/house.jpg') }}">
{% endif %}
The list is pretty long and this is soon going to get out of hand. So I was thinking to simply create an array in twig and check if the value coming from controller exist on that array i have in twig to display an image.
config.yml
, so you can manage assets in the best way. – Jacaranda