You are here

group--teaser.html.twig in Open Social 8.8

Default theme implementation to display a group.

Available variables:

  • group: The group entity with limited access to object properties and methods. Only "getter" methods (method names starting with "get", "has", or "is") and a few common methods such as "id" and "label" are available. Calling other methods (such as group.delete) will result in an exception.
  • label: The title of the group.
  • content: All group items. Use {{ content }} to print them all, or print a subset such as {{ content.field_example }}. Use {{ content|without('field_example') }} to temporarily suppress the printing of a given child element.
  • url: Direct URL of the current group.
  • attributes: HTML attributes for the containing element. The attributes.class element may contain one or more of the following classes:

    • group: The current template type (also known as a "theming hook").
    • group--[type]: The current group type. For example, if the group is a "Classroom" it would result in "group--classroom". Note that the machine name will often be in a short form of the human readable label.
    • group--[view_mode]: The View Mode of the group; for example, a teaser would result in: "group--teaser", and full: "group--full".
  • title_attributes: Same as attributes, except applied to the main title tag that appears in the template.
  • content_attributes: Same as attributes, except applied to the main content tag that appears in the template.
  • title_prefix: Additional output populated by modules, intended to be displayed in front of the main title tag that appears in the template.
  • title_suffix: Additional output populated by modules, intended to be displayed after the main title tag that appears in the template.
  • view_mode: View mode; for example, "teaser" or "full".
  • page: Flag for the full page state. Will be true if view_mode is 'full'.

File

themes/socialbase/templates/group/group--teaser.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a group.
  5. *
  6. * Available variables:
  7. * - group: The group entity with limited access to object properties and
  8. * methods. Only "getter" methods (method names starting with "get", "has",
  9. * or "is") and a few common methods such as "id" and "label" are available.
  10. * Calling other methods (such as group.delete) will result in an exception.
  11. * - label: The title of the group.
  12. * - content: All group items. Use {{ content }} to print them all,
  13. * or print a subset such as {{ content.field_example }}. Use
  14. * {{ content|without('field_example') }} to temporarily suppress the
  15. * printing of a given child element.
  16. * - url: Direct URL of the current group.
  17. * - attributes: HTML attributes for the containing element.
  18. * The attributes.class element may contain one or more of the following
  19. * classes:
  20. * - group: The current template type (also known as a "theming hook").
  21. * - group--[type]: The current group type. For example, if the group is a
  22. * "Classroom" it would result in "group--classroom". Note that the machine
  23. * name will often be in a short form of the human readable label.
  24. * - group--[view_mode]: The View Mode of the group; for example, a
  25. * teaser would result in: "group--teaser", and full: "group--full".
  26. * - title_attributes: Same as attributes, except applied to the main title
  27. * tag that appears in the template.
  28. * - content_attributes: Same as attributes, except applied to the main
  29. * content tag that appears in the template.
  30. * - title_prefix: Additional output populated by modules, intended to be
  31. * displayed in front of the main title tag that appears in the template.
  32. * - title_suffix: Additional output populated by modules, intended to be
  33. * displayed after the main title tag that appears in the template.
  34. * - view_mode: View mode; for example, "teaser" or "full".
  35. * - page: Flag for the full page state. Will be true if view_mode is 'full'.
  36. *
  37. * @see template_preprocess_group()
  38. *
  39. * @ingroup themeable
  40. */
  41. #}
  42. {{ attach_library('socialbase/teaser')}}
  43. {%
  44. set classes = [
  45. 'card',
  46. 'teaser',
  47. not content.field_group_image|render ? 'no-image'
  48. ]
  49. %}
  50. <div{{ attributes.addClass(classes) }}>
  51. <div class='teaser__image'>
  52. {% block card_image %}
  53. {{ content.field_group_image }}
  54. {% endblock %}
  55. {% block card_teaser_type %}
  56. <a href="{{ url }}">
  57. <div class="teaser__teaser-type">
  58. <svg class="teaser__teaser-type-icon">
  59. <use xlink:href="#icon-group-white"></use>
  60. </svg>
  61. </div>
  62. </a>
  63. {% endblock %}
  64. </div>
  65. <div class='teaser__body'>
  66. <div class="teaser__content">
  67. {% block card_title %}
  68. {{ title_prefix }}
  69. <h4{{ title_attributes }} class="teaser__title">
  70. {% if closed_group_lock %}
  71. <svg class="icon-gray icon-small">
  72. <use xlink:href="#icon-lock"></use>
  73. </svg>
  74. {% elseif secret_group_shield %}
  75. <svg class="icon-gray icon-small">
  76. <use xlink:href="#icon-shield"></use>
  77. </svg>
  78. {% endif %}
  79. <a href="{{ url }}" rel="bookmark">{{ label }}</a>
  80. </h4>
  81. {{ title_suffix }}
  82. {% endblock %}
  83. {% block card_body %}
  84. <div class="teaser__content-line">
  85. <svg class="teaser__content-type-icon">
  86. <use xlink:href="#icon-label"></use>
  87. </svg>
  88. <span class="teaser__content-text">
  89. {{ group_type }}
  90. {{ group_settings_help }}
  91. </span>
  92. </div>
  93. {% if content.field_group_location|render or content.field_group_address|render %}
  94. <div class="teaser__content-line">
  95. <svg class="teaser__content-type-icon">
  96. <use xlink:href="#icon-location"></use>
  97. </svg>
  98. <span class="teaser__content-text">
  99. {{ content.field_group_location }}
  100. {% if content.field_group_location|render is not empty and content.field_group_address|render is not empty %} &bullet;{% endif %}
  101. {{ content.field_group_address }}
  102. </span>
  103. </div>
  104. {% endif %}
  105. {% endblock %}
  106. </div>
  107. <div class="card__actionbar">
  108. {% block card_actionbar %}
  109. {% if group_members is not empty %}
  110. <div class="badge teaser__badge" title="{% trans %}Total amount of group members{% endtrans %}">
  111. <span class="badge__container">
  112. <svg class="badge__icon">
  113. <use xlink:href="#icon-group"></use>
  114. </svg>
  115. <span class="badge__label">
  116. {{ group_members }}
  117. </span>
  118. </span>
  119. </div>
  120. {% endif %}
  121. {% if joined %}
  122. <span class="badge teaser__badge badge-default">
  123. {% trans with {'context': 'Is a member'} %}You have joined{% endtrans %}
  124. </span>
  125. {% endif %}
  126. <a href="{{ url }}" class="card__link" title="{{ label }}">
  127. {% trans %}Read more{% endtrans %}
  128. </a>
  129. {% endblock %}
  130. </div>
  131. </div>
  132. </div>