You are here

post.html.twig in Open Social 8.6

post.html.twig Default theme implementation to present Post data.

This template is used when viewing Post pages.

Available variables:

  • content: A list of content items. Use 'content' to print all content, or
  • attributes: HTML attributes for the container element.

File

themes/socialbase/templates/post/post.html.twig
View source
  1. {#
  2. /**
  3. * @file post.html.twig
  4. * Default theme implementation to present Post data.
  5. *
  6. * This template is used when viewing Post pages.
  7. *
  8. *
  9. * Available variables:
  10. * - content: A list of content items. Use 'content' to print all content, or
  11. * - attributes: HTML attributes for the container element.
  12. *
  13. * @see template_preprocess_post()
  14. *
  15. * @ingroup themeable
  16. */
  17. #}
  18. {{ attach_library('socialbase/comment') }}
  19. {{ attach_library('socialbase/post') }}
  20. {{ attach_library('socialbase/page-node')}}
  21. {%
  22. set classes = [
  23. 'media',
  24. not published ? 'post-unpublished',
  25. ]
  26. %}
  27. <div class="card">
  28. <div class="card__block">
  29. <div class="media-wrapper">
  30. <div {{ attributes.addClass(classes) }}>
  31. <div class="media-left avatar">
  32. {% if author_picture %}
  33. {{ author_picture }}
  34. {% endif %}
  35. </div>
  36. <div class="media-body">
  37. <div class="media-heading text-m">
  38. {% if content.user_id %}
  39. {{ content.user_id }}
  40. {% endif %}
  41. <div class="post-date">
  42. {{ date }}
  43. {% if visibility_icon and visibility_label %}
  44. <svg class="margin-left-s icon-visibility">
  45. <use xlink:href="#icon-{{ visibility_icon }}"></use>
  46. </svg>
  47. <strong>{{ visibility_label }}</strong>
  48. {% endif %}
  49. {% if not published %}
  50. <span class="badge badge-default badge--pill">
  51. {% trans %} unpublished {% endtrans %}
  52. </span>
  53. {% endif %}
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. {% if content.links %}
  59. {{ content.links }}
  60. {% endif %}
  61. </div>
  62. <div class="margin-top-s iframe-container">
  63. {{ content|without('links', 'field_post_comments', 'like_and_dislike', 'field_post_image', 'user_id') }}
  64. {% if content.field_post_image|render %}
  65. <p>{{ content.field_post_image }}</p>
  66. {% endif %}
  67. <div class="clearfix"></div>
  68. {{ content.like_and_dislike }}
  69. </div>
  70. {% if logged_in %}
  71. <div class="card__nested-section">
  72. {{ content.field_post_comments }}
  73. </div>
  74. {% endif %}
  75. </div>
  76. </div>