templates/platform/component/atom/link_img_static.html.twig line 1

Open in your IDE?
  1. {# configuration example
  2. ###########
  3. class: col-md-4
  4. enabled: true
  5. link:
  6. enabled: false
  7. tel: ''
  8. mailto: ''
  9. url: ''
  10. route: ''
  11. params: ''
  12. class: ''
  13. target: _self
  14. img:
  15. url: ''
  16. alt: 'test test'
  17. class: ''
  18. #}
  19. {% if componentKey is not defined %}
  20. {% set componentKey = "link_img_static" %}
  21. {% endif %}
  22. {% set item_config = generateComponentOptions(value, componentKey)%}
  23. {% if canDisplayComponentByAcl(item_config) %}
  24. {% if value.link.enabled is not defined or value.link.enabled %}
  25. {% set url = getItemLink(value.link)%}
  26. {% if url is not same as('') %}
  27. <a href="{{ url }}"
  28. {# {% if value.link.class is defined %}class="{{ value.link.class }}"{% endif %}#}
  29. {% if value.link.target is defined %}target="{{ value.link.target }}"{% endif %}>
  30. {% endif %}
  31. {% endif %}
  32. {% set img = value.img is defined ? value.img : value %}
  33. {% if img.url is same as('') %}
  34. <div style="width: 150px; height: 150px; line-height: 150px; text-align: center; border: 2px dashed grey">
  35. <small>{{ 'ajouter une image dans dtv'|trans }}</small>
  36. </div>
  37. {% else %}
  38. <img src="{{ path('static_project_file', {'fileName': img.url}) }}" alt="{{ img.alt }}"
  39. class="img-fluid {% if img.class is defined %}{{ img.class }}{% endif %}">
  40. {% endif %}
  41. {% if url is defined and url is not null %}
  42. </a>
  43. {% endif %}
  44. {% endif %}