You are here

function template_preprocess_gridstack_dummy in GridStack 8

Prepares variables for gridstack-admin.html.twig templates.

File

templates/gridstack.theme.inc, line 185
Hooks and preprocess functions for the GridStack module.

Code

function template_preprocess_gridstack_dummy(&$variables) {
  $element = $variables['element'];
  $all = [
    'delta',
    'dummies',
    'image_style',
    'item',
    'nested_grids',
    'settings',
  ];
  foreach ($all as $key) {
    $variables[$key] = isset($element["#{$key}"]) ? $element["#{$key}"] : [];
  }
  $variables['index'] = (int) $variables['delta'] + 1;
  $variables['content'] = $element['#children'];
  foreach ([
    'box',
    'button_add',
    'button_remove',
    'nested',
  ] as $key) {
    $variables[$key . '_attributes'] = new Attribute();
  }
}