You are here

public function GridStack::gridsJsonToArray in GridStack 8

Converts gridstack breakpoint grids from stored JSON into array.

File

src/Entity/GridStack.php, line 266

Class

GridStack
Defines the GridStack configuration entity.

Namespace

Drupal\gridstack\Entity

Code

public function gridsJsonToArray(array &$settings = []) {
  $settings['breakpoints'] = array_filter($this
    ->getBreakpoints());
  if (!empty($settings['breakpoints'])) {
    foreach ($settings['breakpoints'] as $key => $breakpoint) {
      if (!empty($breakpoint['grids']) && is_string($breakpoint['grids'])) {
        $settings['breakpoints'][$key]['grids'] = Json::decode($breakpoint['grids']);
      }
      if (!empty($breakpoint['nested']) && is_string($breakpoint['nested'])) {
        $settings['breakpoints'][$key]['nested'] = Json::decode($breakpoint['nested']);
      }
    }
  }
}