You are here

loader.html.twig in Bamboo Twig 8.5

<div class="test-loaders">


  <!-- Get Current User -->
  <h2>Current User</h2>
  <hr>
  {% set user = bamboo_load_currentuser() %}
  <div class="loader-current-user">{{ user.name.value }}</div>

  <!-- Loader Node -->
  <h2>Loader Node</h2>
  <hr>
  {% set article = bamboo_load_entity('node', 1) %}
  <div class="loader-entity-node-1">{{ article.title.value }}</div>
  {% set article = bamboo_load_entity('node', 2) %}
  <div class="loader-entity-node-2">{{ article.title.value }}</div>
  {% set article = bamboo_load_entity('node', 3) %}
  <div class="loader-entity-node-3">{{ article.title.value }}</div>
  {% set article = bamboo_load_entity('node', 4) %}
  <div class="loader-entity-node-4">{{ article.title.value }}</div>
  {% set article = bamboo_load_entity('node', 5) %}
  <div class="loader-entity-node-5">{{ article.title.value }}</div>

  <!-- Loader Taxonomy -->
  <h2>Loader Taxonomy</h2>
  <hr>
  {% set term = bamboo_load_entity('taxonomy_term', 1) %}
  <div class="loader-entity-taxonomy-term-1">{{ term.name.value }}</div>
  {% set term = bamboo_load_entity('taxonomy_term', 2) %}
  <div class="loader-entity-taxonomy-term-2">{{ term.name.value }}</div>
  {% set term = bamboo_load_entity('taxonomy_term', 3) %}
  <div class="loader-entity-taxonomy-term-3">{{ term.name.value }}</div>
  {% set term = bamboo_load_entity('taxonomy_term', 4) %}
  <div class="loader-entity-taxonomy-term-4">{{ term.name.value }}</div>
  {% set term = bamboo_load_entity('taxonomy_term', 5) %}
  <div class="loader-entity-taxonomy-term-5">{{ term.name.value }}</div>

  <!-- Referenced field -->
  <!-- Referenced field should always show referenced entity in his original lang -->
  <h2>Referenced field</h2>
  <hr>
  {% set article = bamboo_load_entity('node', 1) %}
  <div class="loader-entity-reference-field-1">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>
  {% set article = bamboo_load_entity('node', 2) %}
  <div class="loader-entity-reference-field-2">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>
  {% set article = bamboo_load_entity('node', 3) %}
  <div class="loader-entity-reference-field-3">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>
  {% set article = bamboo_load_entity('node', 4) %}
  <div class="loader-entity-reference-field-4">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>
  {% set article = bamboo_load_entity('node', 5) %}
  <div class="loader-entity-reference-field-5">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>

  <!-- Loader Entity -->
  <h2>Loader Entity</h2>
  <hr>
  {% set file = bamboo_load_entity('file', 1) %}
  <div class="loader-entity-file">{{ file.filename.value }}</div>
  {% set user = bamboo_load_entity('user', 1) %}
  <div class="loader-entity-user">{{ user.name.value }}</div>

  <!-- Loader Field -->
  <h2>Loader Field</h2>
  <hr>
  {% set article_title = bamboo_load_field('title', 'node', 1) %}
  <div class="loader-field-node-1">{{ article_title.value }}</div>
  {% set article_title = bamboo_load_field('title', 'node', 2) %}
  <div class="loader-field-node-2">{{ article_title.value }}</div>
  {% set article_title = bamboo_load_field('title', 'node', 3) %}
  <div class="loader-field-node-3">{{ article_title.value }}</div>
  {% set article_title = bamboo_load_field('title', 'node', 4) %}
  <div class="loader-field-node-4">{{ article_title.value }}</div>
  {% set article_title = bamboo_load_field('title', 'node', 5) %}
  <div class="loader-field-node-5">{{ article_title.value }}</div>
  <br>
  {% set term_name = bamboo_load_field('name', 'taxonomy_term', 1) %}
  <div class="loader-field-taxonomy-term-1">{{ term_name.value }}</div>
  {% set term_name = bamboo_load_field('name', 'taxonomy_term', 2) %}
  <div class="loader-field-taxonomy-term-2">{{ term_name.value }}</div>
  {% set term_name = bamboo_load_field('name', 'taxonomy_term', 3) %}
  <div class="loader-field-taxonomy-term-3">{{ term_name.value }}</div>
  {% set term_name = bamboo_load_field('name', 'taxonomy_term', 4) %}
  <div class="loader-field-taxonomy-term-4">{{ term_name.value }}</div>
  {% set term_name = bamboo_load_field('name', 'taxonomy_term', 5) %}
  <div class="loader-field-taxonomy-term-5">{{ term_name.value }}</div>
  <br>
  {% set article_tag = bamboo_load_field('field_tags', 'node', 1) %}
  <div class="loader-field-reference-1">{{ article_tag.entity.name.value }}</div>
  {% set article_tag = bamboo_load_field('field_tags', 'node', 2) %}
  <div class="loader-field-reference-2">{{ article_tag.entity.name.value }}</div>
  {% set article_tag = bamboo_load_field('field_tags', 'node', 3) %}
  <div class="loader-field-reference-3">{{ article_tag.entity.name.value }}</div>
  {% set article_tag = bamboo_load_field('field_tags', 'node', 4) %}
  <div class="loader-field-reference-4">{{ article_tag.entity.name.value }}</div>
  {% set article_tag = bamboo_load_field('field_tags', 'node', 5) %}
  <div class="loader-field-reference-5">{{ article_tag.entity.name.value }}</div>
  <br>
  {% set filename = bamboo_load_field('filename', 'file', 1) %}
  <div class="loader-field-file">{{ filename.value }}</div>
  {% set username = bamboo_load_field('name', 'user', 1) %}
  <div class="loader-field-user">{{ username.value }}</div>

  <!-- Loader Image -->
  <h2>Loader Image</h2>
  <hr>
  {% set image = bamboo_load_image('public://antistatique.jpg') %}
  <div class="loader-image-uri">{{ image.source }}</div>
  {% set image = bamboo_load_image(variables.image_path) %}
  <div class="loader-image-path">{{ image.source }}</div>
</div>

File

tests/modules/bamboo_twig_test/templates/loader.html.twig
View source
  1. <div class="test-loaders">
  2. <!-- Get Current User -->
  3. <h2>Current User</h2>
  4. <hr>
  5. {% set user = bamboo_load_currentuser() %}
  6. <div class="loader-current-user">{{ user.name.value }}</div>
  7. <!-- Loader Node -->
  8. <h2>Loader Node</h2>
  9. <hr>
  10. {% set article = bamboo_load_entity('node', 1) %}
  11. <div class="loader-entity-node-1">{{ article.title.value }}</div>
  12. {% set article = bamboo_load_entity('node', 2) %}
  13. <div class="loader-entity-node-2">{{ article.title.value }}</div>
  14. {% set article = bamboo_load_entity('node', 3) %}
  15. <div class="loader-entity-node-3">{{ article.title.value }}</div>
  16. {% set article = bamboo_load_entity('node', 4) %}
  17. <div class="loader-entity-node-4">{{ article.title.value }}</div>
  18. {% set article = bamboo_load_entity('node', 5) %}
  19. <div class="loader-entity-node-5">{{ article.title.value }}</div>
  20. <!-- Loader Taxonomy -->
  21. <h2>Loader Taxonomy</h2>
  22. <hr>
  23. {% set term = bamboo_load_entity('taxonomy_term', 1) %}
  24. <div class="loader-entity-taxonomy-term-1">{{ term.name.value }}</div>
  25. {% set term = bamboo_load_entity('taxonomy_term', 2) %}
  26. <div class="loader-entity-taxonomy-term-2">{{ term.name.value }}</div>
  27. {% set term = bamboo_load_entity('taxonomy_term', 3) %}
  28. <div class="loader-entity-taxonomy-term-3">{{ term.name.value }}</div>
  29. {% set term = bamboo_load_entity('taxonomy_term', 4) %}
  30. <div class="loader-entity-taxonomy-term-4">{{ term.name.value }}</div>
  31. {% set term = bamboo_load_entity('taxonomy_term', 5) %}
  32. <div class="loader-entity-taxonomy-term-5">{{ term.name.value }}</div>
  33. <!-- Referenced field -->
  34. <!-- Referenced field should always show referenced entity in his original lang -->
  35. <h2>Referenced field</h2>
  36. <hr>
  37. {% set article = bamboo_load_entity('node', 1) %}
  38. <div class="loader-entity-reference-field-1">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>
  39. {% set article = bamboo_load_entity('node', 2) %}
  40. <div class="loader-entity-reference-field-2">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>
  41. {% set article = bamboo_load_entity('node', 3) %}
  42. <div class="loader-entity-reference-field-3">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>
  43. {% set article = bamboo_load_entity('node', 4) %}
  44. <div class="loader-entity-reference-field-4">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>
  45. {% set article = bamboo_load_entity('node', 5) %}
  46. <div class="loader-entity-reference-field-5">{{ article.title.value }} - {{ article.field_tags.entity.name.value }}</div>
  47. <!-- Loader Entity -->
  48. <h2>Loader Entity</h2>
  49. <hr>
  50. {% set file = bamboo_load_entity('file', 1) %}
  51. <div class="loader-entity-file">{{ file.filename.value }}</div>
  52. {% set user = bamboo_load_entity('user', 1) %}
  53. <div class="loader-entity-user">{{ user.name.value }}</div>
  54. <!-- Loader Field -->
  55. <h2>Loader Field</h2>
  56. <hr>
  57. {% set article_title = bamboo_load_field('title', 'node', 1) %}
  58. <div class="loader-field-node-1">{{ article_title.value }}</div>
  59. {% set article_title = bamboo_load_field('title', 'node', 2) %}
  60. <div class="loader-field-node-2">{{ article_title.value }}</div>
  61. {% set article_title = bamboo_load_field('title', 'node', 3) %}
  62. <div class="loader-field-node-3">{{ article_title.value }}</div>
  63. {% set article_title = bamboo_load_field('title', 'node', 4) %}
  64. <div class="loader-field-node-4">{{ article_title.value }}</div>
  65. {% set article_title = bamboo_load_field('title', 'node', 5) %}
  66. <div class="loader-field-node-5">{{ article_title.value }}</div>
  67. <br>
  68. {% set term_name = bamboo_load_field('name', 'taxonomy_term', 1) %}
  69. <div class="loader-field-taxonomy-term-1">{{ term_name.value }}</div>
  70. {% set term_name = bamboo_load_field('name', 'taxonomy_term', 2) %}
  71. <div class="loader-field-taxonomy-term-2">{{ term_name.value }}</div>
  72. {% set term_name = bamboo_load_field('name', 'taxonomy_term', 3) %}
  73. <div class="loader-field-taxonomy-term-3">{{ term_name.value }}</div>
  74. {% set term_name = bamboo_load_field('name', 'taxonomy_term', 4) %}
  75. <div class="loader-field-taxonomy-term-4">{{ term_name.value }}</div>
  76. {% set term_name = bamboo_load_field('name', 'taxonomy_term', 5) %}
  77. <div class="loader-field-taxonomy-term-5">{{ term_name.value }}</div>
  78. <br>
  79. {% set article_tag = bamboo_load_field('field_tags', 'node', 1) %}
  80. <div class="loader-field-reference-1">{{ article_tag.entity.name.value }}</div>
  81. {% set article_tag = bamboo_load_field('field_tags', 'node', 2) %}
  82. <div class="loader-field-reference-2">{{ article_tag.entity.name.value }}</div>
  83. {% set article_tag = bamboo_load_field('field_tags', 'node', 3) %}
  84. <div class="loader-field-reference-3">{{ article_tag.entity.name.value }}</div>
  85. {% set article_tag = bamboo_load_field('field_tags', 'node', 4) %}
  86. <div class="loader-field-reference-4">{{ article_tag.entity.name.value }}</div>
  87. {% set article_tag = bamboo_load_field('field_tags', 'node', 5) %}
  88. <div class="loader-field-reference-5">{{ article_tag.entity.name.value }}</div>
  89. <br>
  90. {% set filename = bamboo_load_field('filename', 'file', 1) %}
  91. <div class="loader-field-file">{{ filename.value }}</div>
  92. {% set username = bamboo_load_field('name', 'user', 1) %}
  93. <div class="loader-field-user">{{ username.value }}</div>
  94. <!-- Loader Image -->
  95. <h2>Loader Image</h2>
  96. <hr>
  97. {% set image = bamboo_load_image('public://antistatique.jpg') %}
  98. <div class="loader-image-uri">{{ image.source }}</div>
  99. {% set image = bamboo_load_image(variables.image_path) %}
  100. <div class="loader-image-path">{{ image.source }}</div>
  101. </div>