You are here

public function GridStackHook::mapConfigSchemaInfoAlter in GridStack 8.2

Maps config schema.

1 call to GridStackHook::mapConfigSchemaInfoAlter()
GridStackHook::configSchemaInfoAlter in src/GridStackHook.php
Implements hook_config_schema_info_alter().

File

src/GridStackHook.php, line 67

Class

GridStackHook
Provides GridStack utility methods for Drupal hooks.

Namespace

Drupal\gridstack

Code

public function mapConfigSchemaInfoAlter(array &$mappings, $source = '') {
  foreach (GridStackDefault::layoutSettings() as $key => $value) {
    if (is_array($value)) {
      $mappings['mapping'][$key]['type'] = 'sequence';
      $mappings['mapping'][$key]['label'] = $key;
      $mappings['mapping'][$key]['sequence'][0]['type'] = 'mapping';
      $mappings['mapping'][$key]['sequence'][0]['label'] = $key;
    }
    else {
      $mappings['mapping'][$key]['type'] = 'string';
      $mappings['mapping'][$key]['label'] = ucwords($key);
    }
  }
  foreach (GridStackDefault::regionSettings() as $key => $value) {
    if (is_array($value)) {
      $mappings['mapping']['regions']['sequence'][0]['mapping'][$key]['type'] = 'sequence';
      $mappings['mapping']['regions']['sequence'][0]['mapping'][$key]['label'] = $key;
      $mappings['mapping']['regions']['sequence'][0]['mapping'][$key]['sequence'][0]['type'] = 'mapping';
      $mappings['mapping']['regions']['sequence'][0]['mapping'][$key]['sequence'][0]['label'] = $key;
    }
    else {
      $mappings['mapping']['regions']['sequence'][0]['mapping'][$key]['type'] = 'string';
      $mappings['mapping']['regions']['sequence'][0]['mapping'][$key]['label'] = ucwords($key);
    }
  }
}