You are here

public function GridStackManager::libraryInfoBuild in GridStack 8

Implements hook_library_info_build().

File

src/GridStackManager.php, line 574

Class

GridStackManager
Implements GridStackManagerInterface.

Namespace

Drupal\gridstack

Code

public function libraryInfoBuild() {
  $libraries = [];
  if ($skins = $this
    ->getSkins()) {
    foreach ($skins as $key => $skin) {
      $provider = isset($skin['provider']) ? $skin['provider'] : 'gridstack';
      $id = $provider . '.' . $key;
      foreach ([
        'css',
        'js',
        'dependencies',
      ] as $property) {
        if (isset($skin[$property]) && is_array($skin[$property])) {
          $libraries[$id][$property] = $skin[$property];
        }
      }
      $libraries[$id]['dependencies'][] = 'gridstack/skin';
    }
  }
  foreach (range(1, 12) as $key) {
    $libraries['gridstack.' . $key] = [
      'css' => [
        'layout' => [
          'css/layout/grid-stack-' . $key . '.css' => [],
        ],
      ],
    ];
  }
  return $libraries;
}