You are here

gridstack-admin.html.twig in GridStack 8

Default theme implementation for the GridStack template.

Available variables:

  • items: The array of items containing gridstack contents and captions.
  • settings: A cherry-picked settings that mostly defines the box HTML or layout, and none of JS settings/options which are defined at data-config.
  • attributes: The array of attributes to hold classes, id and config data containing JSON object aka JS settings the GridStack expects. We don't store these JS settings in the normal <head>, but inline within data-config attribute instead.

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

File

templates/gridstack-admin.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for the GridStack template.
  5. *
  6. * Available variables:
  7. * - items: The array of items containing gridstack contents and captions.
  8. * - settings: A cherry-picked settings that mostly defines the box HTML or
  9. * layout, and none of JS settings/options which are defined at data-config.
  10. * - attributes: The array of attributes to hold classes, id and config data
  11. * containing JSON object aka JS settings the GridStack expects. We don't
  12. * store these JS settings in the normal <head>, but inline within
  13. * data-config attribute instead.
  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. #}
  23. {%
  24. set preview_classes = [
  25. 'gridstack-preview',
  26. settings.display ? 'gridstack-preview--' ~ settings.display,
  27. settings.breakpoint ? 'gridstack-preview--' ~ settings.breakpoint,
  28. settings.is_main_preview ? 'gridstack-preview--main' : 'gridstack-preview--sub',
  29. settings.breakpoint_width is empty and not settings.is_main_preview ? 'form-disabled',
  30. ]
  31. %}
  32. {%
  33. set content_classes = [
  34. 'gridstack ungridstack gridstack--ui gridstack--js',
  35. settings.nester ? 'gridstack--nester',
  36. settings.class_by_id ? settings.class_by_id|clean_class,
  37. settings.noMargin ? 'gridstack--nomargin',
  38. settings.skin ? 'gridstack--skin--' ~ settings.skin|clean_class,
  39. settings.optionset ? 'gridstack--optionset--' ~ settings.optionset|clean_class,
  40. settings.width ? 'grid-stack-' ~ settings.width,
  41. ]
  42. %}
  43. {%
  44. set wrapper_classes = [
  45. 'gridstack-wrapper',
  46. ]
  47. %}
  48. {% set main_buttons %}
  49. {% if settings.is_main_preview %}
  50. <div class="gridstack-actions form-actions form-wrapper clearfix">
  51. {% for key, button in main_button_texts %}
  52. {% if key == 'save' %}
  53. <button class="button btn btn--gridstack btn--main btn--primary btn--{{ key }}" data-message="{{ key }}" data-storage="{{ settings.storage }}" data-icon="{{ settings.icon_breakpoint }}" data-breakpoint="{{ settings.breakpoint }}">{{ button }}</button>
  54. {% else %}
  55. <button class="button btn btn--gridstack btn--main btn--{{ key }}" data-message="{{ key }}" data-breakpoint="{{ settings.breakpoint }}">{{ button }}</button>
  56. {% endif %}
  57. {% endfor %}
  58. </div>
  59. {% endif %}
  60. {% endset %}
  61. {% spaceless %}
  62. <div{{ preview_attributes.addClass(preview_classes) }}>
  63. <div {{ wrapper_attributes.addClass(wrapper_classes) }}>
  64. <div{{ content_attributes.addClass(content_classes) }}>
  65. {# Empty content populated dynamically by Backbone. #}
  66. </div>
  67. </div>
  68. {% if not settings.no_buttons and settings.is_main_preview %}
  69. {{ main_buttons }}
  70. {% endif %}
  71. </div>
  72. {% endspaceless %}