You are here

public function GridStackHook::libraryInfoAlter in GridStack 8.2

Implements hook_library_info_alter().

File

src/GridStackHook.php, line 98

Class

GridStackHook
Provides GridStack utility methods for Drupal hooks.

Namespace

Drupal\gridstack

Code

public function libraryInfoAlter(&$libraries, $extension) {
  if ($path = \gridstack_libraries_get_path('gridstack')) {
    $libraries['gridstack']['js'] = [
      '/' . $path . '/dist/gridstack.min.js' => [
        'weight' => -2,
      ],
    ];
  }
  if (isset($libraries['backbone'])) {
    $libraries['backbone']['dependencies'][] = $this->manager
      ->configLoad('dev', 'gridstack.settings') ? 'gridstack/dev' : 'gridstack/all';
  }
  if (isset($libraries['load'])) {
    $libraries['load']['dependencies'][] = $this->manager
      ->configLoad('gridstatic', 'gridstack.settings') ? 'gridstack/gridstatic' : 'gridstack/gridstack';
  }
}