You are here

public static function BlazyGrid::buildGridItemAttributes in Blazy 8

Modifies the grid item wrapper attributes.

Parameters

array $grid: The grid item being modified.

array $settings: The given settings.

1 call to BlazyGrid::buildGridItemAttributes()
BlazyGrid::build in src/BlazyGrid.php
Returns items as a grid display wrapped by theme_item_list().

File

src/BlazyGrid.php, line 82

Class

BlazyGrid
Provides grid utilities.

Namespace

Drupal\blazy

Code

public static function buildGridItemAttributes(array &$grid = [], array $settings = []) {
  if (!empty($settings['grid_item_class'])) {
    $grid['#wrapper_attributes']['class'][] = $settings['grid_item_class'];
  }
  $grid['#wrapper_attributes']['class'][] = 'grid';
  if (!empty($settings['type'])) {
    $grid['#wrapper_attributes']['class'][] = 'grid--' . $settings['type'];
  }
  if (!empty($settings['media_switch'])) {
    $grid['#wrapper_attributes']['class'][] = 'grid--' . str_replace('_', '-', $settings['media_switch']);
  }
  $grid['#wrapper_attributes']['class'][] = 'grid--' . $settings['delta'];
}