You are here

protected function GridStackEnginePluginBase::buildItem in GridStack 8.2

Returns an individual item.

3 calls to GridStackEnginePluginBase::buildItem()
GridStackBase::buildDummyItem in src/Plugin/gridstack/engine/GridStackBase.php
Returns the dummy box to measure cell height to fix aspect ratio.
GridStackEnginePluginBase::buildItems in src/GridStackEnginePluginBase.php
Builds GridStack boxes to support nested grids for Bootstrap/ Foundation.
GridStackEnginePluginBase::buildNestedItems in src/GridStackEnginePluginBase.php
Provides nested items if so configured.

File

src/GridStackEnginePluginBase.php, line 401

Class

GridStackEnginePluginBase
Provides base class for all gridstack layout engines.

Namespace

Drupal\gridstack

Code

protected function buildItem($delta, array &$settings, array $item = [], array $regions = []) {
  $content_attributes = [];
  $attributes = isset($item['attributes']) ? $item['attributes'] : [];
  $content = [
    'box' => isset($item['box']) ? $item['box'] : [],
    'caption' => isset($item['caption']) ? $item['caption'] : [],
    'preface' => isset($item['preface']) ? $item['preface'] : [],
  ];
  if (empty($settings['_dummy'])) {
    $this
      ->modifyItem($delta, $settings, $content, $attributes, $content_attributes, $regions);
  }
  return [
    '#theme' => 'gridstack_box',
    '#item' => $content,
    '#delta' => $delta,
    '#attributes' => $attributes,
    '#content_attributes' => $content_attributes,
    '#settings' => $settings,
  ];
}