You are here

public function GridStackManager::setIpeAttributes in GridStack 8

Provides Panels IPE attributes if available.

GridStackLayout has no knowledge of IPE, and IPE expects region keys which are not provided by GridStack, hence rebuild needed attributes.

Parameters

array $box: The box being modified.

array $block: The block containing IPE specific attributes, or complete #prefix.

1 call to GridStackManager::setIpeAttributes()
GridStackManager::buildItems in src/GridStackManager.php
Modifies GridStack boxes to support nested grids for Bootstrap/ Foundation.

File

src/GridStackManager.php, line 237

Class

GridStackManager
Implements GridStackManagerInterface.

Namespace

Drupal\gridstack

Code

public function setIpeAttributes(array &$box = [], array $block = []) {
  if ($block && !empty($block['#prefix'])) {
    $box['#prefix'] = $block['#prefix'];
    foreach (Element::children($box) as $id) {
      if (isset($block[$id]['#attributes']['data-block-id'])) {
        $box[$id]['#attributes']['data-block-id'] = $block[$id]['#attributes']['data-block-id'];
      }
    }
  }
}