protected function GridStack::massageGrids in GridStack 8.2
Returns grids without regions if required.
2 calls to GridStack::massageGrids()
- GridStack::getData in src/
Entity/ GridStack.php - Returns GridStack data as string for container attributes.
- GridStack::getJsonSummaryBreakpoints in src/
Entity/ GridStack.php - Returns JSON for options.breakpoints[xs|sm|md|lg|xl] keyed by indices.
File
- src/
Entity/ GridStack.php, line 257
Class
- GridStack
- Defines the GridStack configuration entity.
Namespace
Drupal\gridstack\EntityCode
protected function massageGrids(array $grids, $exclude_region = TRUE) {
$values = [];
foreach ($grids as $grid) {
if (isset($grid[4]) && !isset($grid['image_style'])) {
$grid[4] = str_replace([
'-',
' ',
], '_', $grid[4]);
}
// Old grid has key image_style, needed pre gridstack_update_8211().
// New grid has no keys, but values, re-purposed image_style for region.
if (isset($grid['image_style']) || $exclude_region && (!empty($grid['region']) || isset($grid[4]))) {
array_pop($grid);
}
$values[] = array_values($grid);
}
return $values;
}