gridstack.html.twig in GridStack 8
Same filename and directory in other branches
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) }}
2 theme calls to gridstack.html.twig
- GridStackManager::build in src/
GridStackManager.php - Returns a cacheable renderable array of a single gridstack instance.
- GridStackManager::buildItems in src/
GridStackManager.php - Modifies GridStack boxes to support nested grids for Bootstrap/ Foundation.
File
templates/gridstack.html.twigView source
- {#
- /**
- * @file
- * 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:
- * @see https://www.drupal.org/node/1906780
- * @see https://www.drupal.org/node/1903374
- * Use Kint: {{ kint(variable) }}
- * Dump all available variables and their contents: {{ dump() }}
- * Dump only the available variable keys: {{ dump(_context|keys) }}
- */
- #}
- {%
- set classes = [
- 'gridstack',
- settings.class_by_id ? settings.class_by_id|clean_class,
- settings.noMargin ? 'gridstack--nomargin',
- settings.skin ? 'gridstack--skin--' ~ settings.skin|clean_class,
- settings.attributes.class ? settings.attributes.class|join(' '),
- settings.use_framework ? 'row' : 'gridstack--js',
- ]
- %}
- {%
- set nested_classes = [
- settings.use_framework ? 'row' : 'gridstack gridstack--nested gridstack--js',
- ]
- %}
- {% spaceless %}
- <{{ wrapper }}{{ attributes.addClass(settings.root ? classes : nested_classes) }}>
-
- {% for item in items %}
- {{ item }}
- {% endfor %}
-
- </{{ wrapper }}>
- {% endspaceless %}