You are here

public function GridStackFormatter::buildSettings in GridStack 8

Same name and namespace in other branches
  1. 8.2 src/GridStackFormatter.php \Drupal\gridstack\GridStackFormatter::buildSettings()

File

src/GridStackFormatter.php, line 16

Class

GridStackFormatter
Implements GridStackFormatterInterface.

Namespace

Drupal\gridstack

Code

public function buildSettings(array &$build, $items) {
  $settings =& $build['settings'];

  // Prepare integration with Blazy.
  $settings['item_id'] = 'box';
  $settings['namespace'] = 'gridstack';

  // Pass basic info to parent::buildSettings().
  parent::buildSettings($build, $items);

  // GridStack specific stuffs.
  $build['optionset'] = GridStack::load($settings['optionset']);

  // Ensures deleted optionset while being used doesn't screw up.
  if (empty($build['optionset'])) {
    $build['optionset'] = GridStack::load('default');
  }

  // Converts gridstack breakpoint grids from stored JSON into array.
  unset($settings['breakpoints']);
  $build['optionset']
    ->gridsJsonToArray($settings);
}