You are here

class GridStackFormatter in GridStack 8

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

Implements GridStackFormatterInterface.

Hierarchy

Expanded class hierarchy of GridStackFormatter

1 string reference to 'GridStackFormatter'
gridstack.services.yml in ./gridstack.services.yml
gridstack.services.yml
1 service uses GridStackFormatter
gridstack.formatter in ./gridstack.services.yml
Drupal\gridstack\GridStackFormatter

File

src/GridStackFormatter.php, line 11

Namespace

Drupal\gridstack
View source
class GridStackFormatter extends BlazyFormatterManager implements GridStackFormatterInterface {

  /**
   * {@inheritdoc}
   */
  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);
  }

}

Members