You are here

protected function GridStackFormBase::massageSettings in GridStack 8.2

Massages the settings specific for when CSS Framework is disabled.

1 call to GridStackFormBase::massageSettings()
GridStackForm::form in modules/gridstack_ui/src/Form/GridStackForm.php
Gets the actual form array to be built.

File

modules/gridstack_ui/src/Form/GridStackFormBase.php, line 692

Class

GridStackFormBase
Extends base form for gridstack instance configuration form.

Namespace

Drupal\gridstack_ui\Form

Code

protected function massageSettings(array &$form) {
  $excludes = [
    'container',
    'details',
    'item',
    'hidden',
    'submit',
  ];
  foreach ($this->default
    ->getOptions('settings') as $name => $value) {
    if (!isset($form['options']['settings'][$name])) {
      continue;
    }
    if (in_array($form['options']['settings'][$name]['#type'], $excludes) && !isset($form['options']['settings'][$name])) {
      continue;
    }
    if ($this->adminCss) {
      if ($form['options']['settings'][$name]['#type'] == 'checkbox') {
        $form['options']['settings'][$name]['#field_suffix'] = ' ';
        $form['options']['settings'][$name]['#title_display'] = 'before';
      }
    }
    if (!isset($form['options']['settings'][$name]['#default_value'])) {
      $form['options']['settings'][$name]['#default_value'] = isset($this->settings[$name]) ? $this->settings[$name] : $value;
    }
  }
}