templates/theme/default/component-blocks/generic-block.html.twig line 1

Open in your IDE?
  1. {% if bloc is defined and bloc is not empty %}
  2. {% set theme_path = 'theme/' ~ app.request.server.get('APP_THEME') ~ '/component-blocks/' %}
  3. {% set template_map = {
  4. 'template': bloc.template is defined ? bloc.template | raw : null,
  5. 'dynamic-block': {
  6. 'principal-block': theme_path ~ 'principal-block.html.twig',
  7. 'benefits-block': theme_path ~ 'benefits-block.html.twig',
  8. 'picto-block': theme_path ~ 'picto-block.html.twig',
  9. },
  10. 'bloc-partenaire': theme_path ~ 'partner_block.html.twig',
  11. 'block-image': theme_path ~ 'image-block.html.twig',
  12. 'block-gallery': theme_path ~ 'gallery-block.html.twig',
  13. 'block-text': theme_path ~ 'title-text-block.html.twig',
  14. 'block-video': theme_path ~ 'video-block.html.twig',
  15. 'block-media-text': theme_path ~ 'media-text-block.html.twig',
  16. 'block-tarifs': theme_path ~ 'tarifs-block.html.twig',
  17. 'block-onglets': theme_path ~ 'onglets-block.html.twig',
  18. 'block-etaps': theme_path ~ 'etaps-block.html.twig',
  19. 'block-links': theme_path ~ 'links-block.html.twig',
  20. 'block-bandeau': theme_path ~ 'bandeau-block.html.twig',
  21. 'dynamic-form': {
  22. 'default': 'theme/' ~ app.request.server.get('APP_THEME') ~ '/component-forms/default_form_template.html.twig',
  23. 'wizard-form': 'theme/' ~ app.request.server.get('APP_THEME') ~ '/component-forms/default_form_wizard.html.twig',
  24. 'contact-form': 'theme/' ~ app.request.server.get('APP_THEME') ~ '/component-forms/contact_form_template.html.twig',
  25. 'question-form': 'theme/' ~ app.request.server.get('APP_THEME') ~ '/component-forms/question_form_template.html.twig',
  26. 'candidature-form': 'theme/' ~ app.request.server.get('APP_THEME') ~ '/component-forms/candidature_form_template.html.twig',
  27. 'encart-contact-form': 'theme/' ~ app.request.server.get('APP_THEME') ~ '/component-forms/encart_contact_form.html.twig',
  28. 'avis-form': 'theme/' ~ app.request.server.get('APP_THEME') ~ '/component-forms/avis_form.html.twig',
  29. }
  30. } %}
  31. {% if bloc.type == 'template' and template_map['template'] %}
  32. {{ template_map['template']|raw }}
  33. {% elseif bloc.type == 'dynamic-block' and bloc.data != null %}
  34. {% if template_map['dynamic-block'][bloc.data.alias] is defined %}
  35. {{ include(template_map['dynamic-block'][bloc.data.alias], { bloc: bloc.data }, with_context = false) }}
  36. {% endif %}
  37. {% elseif template_map[bloc.type] is defined %}
  38. {% if bloc.type == 'dynamic-form' %}
  39. {% if template_map['dynamic-form'][bloc.form.identifier] is defined %}
  40. {{ include(template_map['dynamic-form'][bloc.form.identifier], { bloc: bloc }, with_context = false) }}
  41. {% else %}
  42. {{ include(template_map['dynamic-form']['default'], { bloc: bloc }, with_context = false) }}
  43. {% endif %}
  44. {% else %}
  45. {{ include(template_map[bloc.type], { bloc: bloc }, with_context = false) }}
  46. {% endif %}
  47. {% endif %}
  48. {% endif %}