You are here

support-ticket.html.twig in Support Ticketing System 8

Default theme implementation to display a support ticket.

Available variables:

  • support_ticket: Full support ticket entity.

    • id: The support ticket ID.
    • bundle: The type of the support ticket.
    • authorid: The user ID of the support ticket author.
    • createdtime: Time the support ticket was published formatted in Unix timestamp.
    • changedtime: Time the support ticket was changed formatted in Unix timestamp.
  • label: The title of the support ticket.
  • content: All support ticket 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.
  • author_picture: The support ticket author user entity, rendered using the "compact" view mode.
  • metadata: Metadata for this support ticket.
  • date: Themed creation date field.
  • author_name: Themed author name field.
  • url: Direct URL of the current support ticket.
  • display_submitted: Whether submission information should be displayed.
  • attributes: HTML attributes for the containing element. The attributes.class element may contain one or more of the following classes:

    • support ticket: The current template type (also known as a "theming hook").
    • support ticket--type-[type]: The current support ticket type.
    • support-ticket--view-mode-[view_mode]: The View Mode of the support ticket; for example, a teaser would result in: "support-ticket--view-mode-teaser", and full: "support-ticket--view-mode-full".

    The following are controlled through the support ticket publishing options.

    • support-ticket--locked: Normal users can't make changes to this ticket.
    • support-ticket--unpublished: Appears on unpublished support tickets visible only to site admins.
  • 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.
  • author_attributes: Same as attributes, except applied to the author of the support ticket 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".
  • teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
  • page: Flag for the full page state. Will be true if view_mode is 'full'.
  • readmore: Flag for more state. Will be true if the teaser content of the support ticket cannot hold the main body content.
  • logged_in: Flag for authenticated user status. Will be true when the current user is a logged-in member.
  • is_admin: Flag for admin user status. Will be true when the current user is an administrator.

@todo Remove the id attribute (or make it a class), because if that gets rendered twice on a page this is invalid CSS for example: two lists in different view modes.

File

modules/support_ticket/templates/support-ticket.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a support ticket.
  5. *
  6. * Available variables:
  7. * - support_ticket: Full support ticket entity.
  8. * - id: The support ticket ID.
  9. * - bundle: The type of the support ticket.
  10. * - authorid: The user ID of the support ticket author.
  11. * - createdtime: Time the support ticket was published formatted in Unix timestamp.
  12. * - changedtime: Time the support ticket was changed formatted in Unix timestamp.
  13. * - label: The title of the support ticket.
  14. * - content: All support ticket items. Use {{ content }} to print them all,
  15. * or print a subset such as {{ content.field_example }}. Use
  16. * {{ content|without('field_example') }} to temporarily suppress the printing
  17. * of a given child element.
  18. * - author_picture: The support ticket author user entity, rendered using the "compact"
  19. * view mode.
  20. * - metadata: Metadata for this support ticket.
  21. * - date: Themed creation date field.
  22. * - author_name: Themed author name field.
  23. * - url: Direct URL of the current support ticket.
  24. * - display_submitted: Whether submission information should be displayed.
  25. * - attributes: HTML attributes for the containing element.
  26. * The attributes.class element may contain one or more of the following
  27. * classes:
  28. * - support ticket: The current template type (also known as a "theming hook").
  29. * - support ticket--type-[type]: The current support ticket type.
  30. * - support-ticket--view-mode-[view_mode]: The View Mode of the support ticket; for example, a
  31. * teaser would result in: "support-ticket--view-mode-teaser", and
  32. * full: "support-ticket--view-mode-full".
  33. * The following are controlled through the support ticket publishing options.
  34. * - support-ticket--locked: Normal users can't make changes to this ticket.
  35. * - support-ticket--unpublished: Appears on unpublished support tickets visible only to site
  36. * admins.
  37. * - title_attributes: Same as attributes, except applied to the main title
  38. * tag that appears in the template.
  39. * - content_attributes: Same as attributes, except applied to the main
  40. * content tag that appears in the template.
  41. * - author_attributes: Same as attributes, except applied to the author of
  42. * the support ticket tag that appears in the template.
  43. * - title_prefix: Additional output populated by modules, intended to be
  44. * displayed in front of the main title tag that appears in the template.
  45. * - title_suffix: Additional output populated by modules, intended to be
  46. * displayed after the main title tag that appears in the template.
  47. * - view_mode: View mode; for example, "teaser" or "full".
  48. * - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
  49. * - page: Flag for the full page state. Will be true if view_mode is 'full'.
  50. * - readmore: Flag for more state. Will be true if the teaser content of the
  51. * support ticket cannot hold the main body content.
  52. * - logged_in: Flag for authenticated user status. Will be true when the
  53. * current user is a logged-in member.
  54. * - is_admin: Flag for admin user status. Will be true when the current user
  55. * is an administrator.
  56. *
  57. * @see template_preprocess_support_ticket()
  58. *
  59. * @todo Remove the id attribute (or make it a class), because if that gets
  60. * rendered twice on a page this is invalid CSS for example: two lists
  61. * in different view modes.
  62. *
  63. * @ingroup themeable
  64. */
  65. #}
  66. {%
  67. set classes = [
  68. 'support-ticket',
  69. 'support-ticket--type-' ~ support_ticket.bundle|clean_class,
  70. support-ticket.isLocked() ? 'support-ticket--locked',
  71. not support-ticket.isPublished() ? 'support-ticket--unpublished',
  72. view_mode ? 'support-ticket--view-mode-' ~ view_mode|clean_class,
  73. ]
  74. %}
  75. {{ attach_library('diff/diff.github') }}
  76. <article{{ attributes.addClass(classes) }}>
  77. {{ title_prefix }}
  78. {% if not page %}
  79. <h2{{ title_attributes }}>
  80. <a href="{{ url }}" rel="bookmark">{{ label }}</a>
  81. </h2>
  82. {% endif %}
  83. {{ title_suffix }}
  84. {% if display_submitted %}
  85. <footer class="support_ticket__meta">
  86. {{ author_picture }}
  87. <div{{ author_attributes.addClass('support_ticket__submitted') }}>
  88. {% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
  89. {{ metadata }}
  90. </div>
  91. </footer>
  92. {% endif %}
  93. <div{{ content_attributes.addClass('support_ticket__content') }}>
  94. {{ content|without('links') }}
  95. </div>
  96. {% if content.links %}
  97. <div class="support_ticket__links">
  98. {{ content.links }}
  99. </div>
  100. {% endif %}
  101. </article>