You are here

form.html.twig in Open Social 8.7

Default theme implementation for a 'form' element.

Available variables

  • attributes: A list of HTML attributes for the wrapper element.
  • children: The child elements of the form.

File

themes/socialbase/templates/form/form.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a 'form' element.
  5. *
  6. * Available variables
  7. * - attributes: A list of HTML attributes for the wrapper element.
  8. * - children: The child elements of the form.
  9. *
  10. * @see template_preprocess_form()
  11. *
  12. * @ingroup themeable
  13. */
  14. #}
  15. {% if attributes.hasClass('form--default') %}
  16. {{ attach_library('socialbase/form-default') }}
  17. {% endif %}
  18. {% if attributes.hasClass('card') %}
  19. <form{{ attributes.removeClass('card') }}>
  20. <div class="card">
  21. <div class="card__block">
  22. {{ children }}
  23. </form>
  24. {#
  25. The card is closed function socialbase_form_alter in the info_text suffix
  26. #}
  27. {% elseif is_search_form %}
  28. {% if in_hero_region %}
  29. <form{{ attributes }}>
  30. <div class="form-group">
  31. {{ children }}
  32. </div>
  33. </form>
  34. {% elseif in_content_top_region %}
  35. <form{{ attributes.addClass('search-take-over') }}>
  36. <div class="form-group">
  37. <button class="btn--close-search-take-over" type="button">
  38. <svg class="icon-search-form-close">
  39. <use xlink:href="#icon-close"></use>
  40. </svg>
  41. </button>
  42. {{ children }}
  43. </div>
  44. </form>
  45. {% else %}
  46. <form{{ attributes }}>
  47. <div class="form-group form--navbar-search" id="navbar-search">
  48. {{ children }}
  49. </div>
  50. </form>
  51. {% endif %}
  52. {% else %}
  53. <form{{ attributes }}>
  54. {{ children }}
  55. </form>
  56. {% endif %}