protected function GridStackFormBase::getNodesNested in GridStack 8.2
Returns JSON for options.breakpoints[xs|sm|md|lg|xl] keyed by nodes.
Revert back from keys to keys and values: Original: [[1,0,2,8]. Now: [{"x":1,"y":0,"width":2,"height":8}.
1 call to GridStackFormBase::getNodesNested()
- GridStackForm::previewForm in modules/
gridstack_ui/ src/ Form/ GridStackForm.php - Sets up the preview form.
File
- modules/
gridstack_ui/ src/ Form/ GridStackFormBase.php, line 652
Class
- GridStackFormBase
- Extends base form for gridstack instance configuration form.
Namespace
Drupal\gridstack_ui\FormCode
protected function getNodesNested($grids = '', $nested_grids = '', $exclude_region = FALSE) {
if ($grids && $nested_grids) {
$grids = is_string($grids) ? Json::decode($grids) : $grids;
$nested_grids = is_string($nested_grids) ? Json::decode($nested_grids) : $nested_grids;
$nested_grids = array_values($nested_grids);
$values = [];
foreach (array_keys($grids) as $id) {
if (isset($nested_grids[$id])) {
if (empty($nested_grids[$id])) {
$values[] = [];
}
else {
$values[] = $this
->getNodes($nested_grids[$id], $exclude_region, FALSE);
}
}
}
return Json::encode($values);
}
return '';
}