You are here

protected function FoundationBase::itemAttributes in GridStack 8.2

Modifies the .box attributes.

Overrides GridStackEnginePluginBase::itemAttributes

File

src/Plugin/gridstack/engine/FoundationBase.php, line 88

Class

FoundationBase
Provides the base Foundation layout engine.

Namespace

Drupal\gridstack\Plugin\gridstack\engine

Code

protected function itemAttributes(array &$attributes, array &$settings) {
  parent::itemAttributes($attributes, $settings);
  $classes = $this
    ->optimizeClasses($settings);
  $column = $classes['column'];
  $region = $classes['region'];
  if (!empty($region[0])) {
    $attributes['class'][] = 'box--' . Html::cleanCssIdentifier($region[0]);
  }
  if (!empty($settings['_ungrid'])) {
    return;
  }
  foreach ($this->sizes as $point => $label) {
    if (!isset($column[$point])) {
      continue;
    }
    if ($column[$point]) {
      $attributes['class'][] = $this->colClass . ' ' . $label . '-' . $column[$point];
    }
  }
}