You are here

public function Builder::attach in GridStack 8.2

Provides gridstack skins and libraries.

Overrides Extras::attach

File

src/Plugin/gridstack/stylizer/Builder.php, line 34

Class

Builder
Provides Layout Builder integration for editor previews.

Namespace

Drupal\gridstack\Plugin\gridstack\stylizer

Code

public function attach(array &$load, array $attach = []) {
  parent::attach($load, $attach);

  // Admin assets.
  if (!empty($attach['_ipe'])) {

    // @todo remove modal later.
    $load['library'][] = 'gridstack/admin_modal';
    $load['library'][] = 'gridstack/admin_layout';

    // The CSS framework grid library for admin pages.
    if (!empty($attach['library'])) {
      $library = $attach['library'];
      if (strpos($library, ',') !== FALSE) {
        $items = array_map('trim', explode(',', $library));
        foreach ($items as $item) {
          $load['library'][] = $item;
        }
      }
      else {
        $load['library'][] = $library;
      }
    }
  }
}