You are here

protected function GridStackEnginePluginBase::modifyNestedItem in GridStack 8.2

Modifies nested item contents and attributes.

1 call to GridStackEnginePluginBase::modifyNestedItem()
GridStackEnginePluginBase::modifyItem in src/GridStackEnginePluginBase.php
Modifies item content and attributes.

File

src/GridStackEnginePluginBase.php, line 376

Class

GridStackEnginePluginBase
Provides base class for all gridstack layout engines.

Namespace

Drupal\gridstack

Code

protected function modifyNestedItem($delta, array &$settings, array &$content, array &$attributes, array &$content_attributes, array $regions = []) {

  // Provides configurable content attributes via Layout Builder.
  $this
    ->attributes($content_attributes, $settings);

  // Nested grids with preserved indices even if empty so to layout.
  // Only CSS Framework has nested grids for now, not js-driven layouts.
  if (isset($content['box'][0], $content['box'][0]['box']) && ($nesteds = $this->optionset
    ->getNestedGridsByDelta($delta))) {
    $settings['nested'] = TRUE;
    $settings['root'] = FALSE;
    $settings['use_inner'] = FALSE;

    // Overrides with a sub-theme_gridstack() containing nested boxes.
    $content['box'] = $this
      ->buildNestedItems($delta, $settings, $content['box'], $nesteds, $regions);
    $attributes['class'][] = 'box--nester';
  }
  if (isset($settings['_root']) && $settings['_root'] == 'nested') {
    $attributes['class'][] = 'box--nested';
  }
}