You are here

photos-image.html.twig in Album Photos 6.0.x

Same filename and directory in other branches
  1. 8.5 templates/photos-image.html.twig

Default theme implementation to display a photos_image.

Available variables:

  • photos_image: The photos_image entity with limited access to object properties and methods. Only method names starting with "get", "has", or "is" and a few common methods such as "id", "label", and "bundle" are available. For example:

    • photos_image.getCreatedTime() will return the photos_image creation timestamp.
    • photos_image.hasField('field_example') returns TRUE if the photos_image bundle includes field_example. (This does not indicate the presence of a value in this field.)
    • photos_image.isPublished() will return whether the image is published or not.
  • photos_album_node: The node entity with limited access to object properties and methods.
    • photos_album_node.label is the album title.
  • photos_album_node.album:
    • photos_album_node.album.count is the number of images in the album.
    • photos_album_node.album.cover is the album cover image.
  • label: (optional) The title of the image.
  • content: All photos_image 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 photos_image.
  • attributes: HTML attributes for the containing element.
  • title_suffix: Additional output populated by modules, intended to be displayed after the main title tag that appears in the template. This is required to enable inline quick edit.
  • view_mode: View mode; for example, "cover", "full", "pager" or "sort".
  • page: Flag for the full page state. Will be true if view_mode is 'full'.
  • 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.
  • disableImageVisitCount: True if image visit count is disabled.
  • pager: The previous (prevUrl) and next (nextUrl) image URL if any.
    • pager.prevUrl: Previous photos_image URL.
    • pager.nextURL: Next photos_image URL.
  • setToCover: Set to cover link.
  • visitCount: The number of visits.
  • visitCountTxt: The default visit text "visit" or "visits".

File

templates/photos-image.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a photos_image.
  5. *
  6. * Available variables:
  7. * - photos_image: The photos_image entity with limited access to object
  8. * properties and methods. Only method names starting with "get", "has",
  9. * or "is" and a few common methods such as "id", "label", and "bundle" are
  10. * available. For example:
  11. * - photos_image.getCreatedTime() will return the photos_image creation timestamp.
  12. * - photos_image.hasField('field_example') returns TRUE if the photos_image bundle
  13. * includes field_example. (This does not indicate the presence of a value in this
  14. * field.)
  15. * - photos_image.isPublished() will return whether the image is published or not.
  16. * - photos_album_node: The node entity with limited access to object properties and methods.
  17. * - photos_album_node.label is the album title.
  18. * - photos_album_node.album:
  19. * - photos_album_node.album.count is the number of images in the album.
  20. * - photos_album_node.album.cover is the album cover image.
  21. * - label: (optional) The title of the image.
  22. * - content: All photos_image items. Use {{ content }} to print them all,
  23. * or print a subset such as {{ content.field_example }}. Use
  24. * {{ content|without('field_example') }} to temporarily suppress the printing
  25. * of a given child element.
  26. * - url: Direct URL of the current photos_image.
  27. * - attributes: HTML attributes for the containing element.
  28. * - title_suffix: Additional output populated by modules, intended to be
  29. * displayed after the main title tag that appears in the template.
  30. * This is required to enable inline quick edit.
  31. * - view_mode: View mode; for example, "cover", "full", "pager" or "sort".
  32. * - page: Flag for the full page state. Will be true if view_mode is 'full'.
  33. * - logged_in: Flag for authenticated user status. Will be true when the
  34. * current user is a logged-in member.
  35. * - is_admin: Flag for admin user status. Will be true when the current user
  36. * is an administrator.
  37. * - disableImageVisitCount: True if image visit count is disabled.
  38. * - pager: The previous (prevUrl) and next (nextUrl) image URL if any.
  39. * - pager.prevUrl: Previous photos_image URL.
  40. * - pager.nextURL: Next photos_image URL.
  41. * - setToCover: Set to cover link.
  42. * - visitCount: The number of visits.
  43. * - visitCountTxt: The default visit text "visit" or "visits".
  44. *
  45. * @see template_preprocess_photos_image()
  46. *
  47. * @ingroup themeable
  48. */
  49. #}
  50. <article{{ attributes }}>
  51. <div class="photos-links-info">
  52. {% if not disableImageVisitCount %}
  53. <span id="photos-visits-{{ photos_image.id() }}" class="photos-visits hidden">
  54. {{ visitCount }}
  55. </span>
  56. {% endif %}
  57. {% if commentCount %}
  58. {{ commentCount }}
  59. {% endif %}
  60. {% if setToCover %}
  61. {{ setToCover }}
  62. {% endif %}
  63. </div>
  64. {% if pager.prevUrl or pager.nextUrl %}
  65. <div class="photos-link-pager">
  66. {% if pager.prevUrl %}
  67. <div class="photos-pager-left">
  68. <a href="{{ pager.prevUrl }}">&laquo; {{ 'previous'|t }}</a>
  69. </div>
  70. {% endif %}
  71. {% if pager.nextUrl %}
  72. <div class="photos-pager-right">
  73. <a href="{{ pager.nextUrl }}">{{ 'next'|t }} &raquo;</a>
  74. </div>
  75. {% endif %}
  76. </div>
  77. {% endif %}
  78. {{ title_suffix }}
  79. <div{{ content_attributes }}>
  80. {% if view_mode == 'list' %}
  81. <h2 class="photos-list-view-title">
  82. {{ label }}
  83. </h2>
  84. {% endif %}
  85. {{ content }}
  86. </div>
  87. {{ legacy_comments }}
  88. </article>