You are here

gridstack-dummy.html.twig in GridStack 8

Default theme implementation for the GridStack dummy template.

Available variables:

  • delta: The current index.
  • dummies: The flag that indicates the template is built up for JS cloning. If false, then it is the actual dummy content.
  • image_style: The individual image style for the dummy.
  • nested_grids: The nested grids if available.
  • settings: A cherry-picked settings that mostly defines the box HTML or layout, and none of JS settings which are defined at data-config.

Debug: Use Kint: {{ kint(variable) }} Dump all available variables and their contents: {{ dump() }} Dump only the available variable keys: {{ dump(_context|keys) }}

@todo: Clean up traces of old HTML approach prior to Backbone.

File

templates/gridstack-dummy.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for the GridStack dummy template.
  5. *
  6. * Available variables:
  7. * - delta: The current index.
  8. * - dummies: The flag that indicates the template is built up for JS cloning.
  9. * If false, then it is the actual dummy content.
  10. * - image_style: The individual image style for the dummy.
  11. * - nested_grids: The nested grids if available.
  12. * - settings: A cherry-picked settings that mostly defines the box HTML or
  13. * layout, and none of JS settings which are defined at data-config.
  14. *
  15. * Debug:
  16. * @see https://www.drupal.org/node/1906780
  17. * @see https://www.drupal.org/node/1903374
  18. * Use Kint: {{ kint(variable) }}
  19. * Dump all available variables and their contents: {{ dump() }}
  20. * Dump only the available variable keys: {{ dump(_context|keys) }}
  21. *
  22. * @todo: Clean up traces of old HTML approach prior to Backbone.
  23. */
  24. #}
  25. {%
  26. set add_classes = [
  27. 'button btn btn--dummy btn--gridstack btn--content btn--nested',
  28. settings.nester ? 'visually-hidden',
  29. ]
  30. %}
  31. {%
  32. set remove_classes = [
  33. 'button btn btn--dummy btn--gridstack btn--content btn--remove',
  34. ]
  35. %}
  36. {%
  37. set nested_classes = [
  38. 'gridstack ungridstack gridstack--ui gridstack--dummy gridstack--nested gridstack--js',
  39. ]
  40. %}
  41. {%
  42. set box_classes = [
  43. 'gridstack__box box box--dummy grid-stack-item',
  44. ]
  45. %}
  46. {% set content_buttons %}
  47. <div class="btn-group btn-group--dummy btn-group--nested">
  48. {% if not settings.is_framework %}
  49. {{ image_style }}
  50. {% endif %}
  51. <button {{ button_add_attributes.addClass(add_classes)
  52. .setAttribute('data-index', index)
  53. .setAttribute('data-storage', settings.storage)
  54. .setAttribute('data-message', 'nested') }}>+</button>
  55. <button {{ button_remove_attributes.addClass(remove_classes)
  56. .setAttribute('data-index', index)
  57. .setAttribute('data-storage', settings.storage)
  58. .setAttribute('data-message', 'remove') }}>&times;</button>
  59. </div>
  60. <span class="box__handle">::</span>
  61. <div{{ nested_attributes.addClass(nested_classes)
  62. .setAttribute('data-config', settings.config)
  63. .setAttribute('data-gid', index)
  64. .setAttribute('data-index', index)
  65. .setAttribute('data-preview-grids', nested_grids)
  66. .setAttribute('data-breakpoint', settings.breakpoint)
  67. .setAttribute('data-storage', settings.storage)
  68. }}></div>
  69. {% endset %}
  70. {% set box_dummy %}
  71. <div{{ box_attributes.addClass(box_classes) }}>
  72. <div class="box__content box__content--dummy">
  73. {{ content_buttons }}
  74. </div>
  75. </div>
  76. {% endset %}
  77. {% if dummies %}
  78. <div id="gridstack-box-template">{{ box_dummy }}</div>
  79. {{ content }}
  80. {% else %}
  81. {% if item %}
  82. {{ item }}
  83. {{ content }}
  84. {% else %}
  85. {{ content_buttons }}
  86. {% endif %}
  87. {% endif %}