You are here

public function GridStackManager::prepareSettings in GridStack 8.2

Build the HTML settings.

1 call to GridStackManager::prepareSettings()
GridStackManager::prepareBuild in src/GridStackManager.php
Prepares GridStack build.

File

src/GridStackManager.php, line 205

Class

GridStackManager
Implements GridStackManagerInterface.

Namespace

Drupal\gridstack

Code

public function prepareSettings(array &$settings) {
  $settings += array_merge(GridStackDefault::htmlSettings(), $this
    ->getGridStackSettings());

  // The use_nested is not for js or native Grid, _yet, but CSS framework.
  $settings['column'] = $this->optionset
    ->getSetting('column', 12);
  $settings['use_nested'] = $settings['use_framework'] = !empty($settings['framework']) && $this->optionset
    ->getOption('use_framework');
  $settings['gridnative'] = !$settings['use_framework'] && !empty($settings['gridnative']);
  $settings['_gridstack'] = TRUE;

  // Provides configurable layout engines.
  if ($settings['use_framework']) {
    $settings['background'] = $settings['_gridstack'] = $settings['use_js'] = FALSE;
    $settings['_engine'] = $settings['framework'];
  }
  else {

    // Provides programmatic layout engines.
    $settings['_gridstack'] = empty($settings['ungridstack']);
    $fallback = $settings['gridnative'] ? 'gridstack_native' : 'gridstack_js';
    $settings['_engine'] = empty($settings['_engine']) ? $fallback : $settings['_engine'];
  }
  $settings['id'] = Blazy::getHtmlId('gridstack-' . $settings['optionset'] . '-' . $settings['_engine'], $settings['id']);
  $this
    ->setEngineId($settings['_engine']);
}