You are here

protected function GridStackEnginePluginBase::nestedContainerAttributes in GridStack 8.2

Returns the .gridstack nested container attributes.

1 call to GridStackEnginePluginBase::nestedContainerAttributes()
GridStackEnginePluginBase::buildNestedItems in src/GridStackEnginePluginBase.php
Provides nested items if so configured.

File

src/GridStackEnginePluginBase.php, line 524

Class

GridStackEnginePluginBase
Provides base class for all gridstack layout engines.

Namespace

Drupal\gridstack

Code

protected function nestedContainerAttributes(array &$settings) {
  $attributes['class'] = $this->nestedContainerClasses;
  $index = isset($settings['delta']) ? $settings['delta'] + 1 : 0;

  // Required by dynamic styling.
  $attributes['class'][] = 'gridstack--' . $index;

  // Optional, not really important.
  if (!$this
    ->getSetting('no_classes')) {
    $attributes['class'][] = 'gridstack--nested';
  }

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

  // This one is a container, not a registered region for layouts. Yet
  // provides the consistent selectors for editor live preview styling.
  if ($this
    ->getSetting('_ipe') && $settings['_level'] == GridStackDefault::LEVEL_NESTED) {
    $attributes['data-region'] = $settings['rid'];
  }
  return $attributes;
}