GridStackFormatter.php in GridStack 8
File
src/GridStackFormatter.php
View source
<?php
namespace Drupal\gridstack;
use Drupal\gridstack\Entity\GridStack;
use Drupal\blazy\BlazyFormatterManager;
class GridStackFormatter extends BlazyFormatterManager implements GridStackFormatterInterface {
public function buildSettings(array &$build, $items) {
$settings =& $build['settings'];
$settings['item_id'] = 'box';
$settings['namespace'] = 'gridstack';
parent::buildSettings($build, $items);
$build['optionset'] = GridStack::load($settings['optionset']);
if (empty($build['optionset'])) {
$build['optionset'] = GridStack::load('default');
}
unset($settings['breakpoints']);
$build['optionset']
->gridsJsonToArray($settings);
}
}