You are here

protected function Media::mediaSettings in GridStack 8.2

Returns the data understood by Blazy for CSS background.

1 call to Media::mediaSettings()
Media::prepareMedia in src/Plugin/gridstack/stylizer/Media.php
Returns the formatted media as Blazy output.

File

src/Plugin/gridstack/stylizer/Media.php, line 165

Class

Media
Provides the media styles for front-end.

Namespace

Drupal\gridstack\Plugin\gridstack\stylizer

Code

protected function mediaSettings(array $settings) {
  $styles = empty($settings['styles']) ? [] : $settings['styles'];
  $data = empty($styles['metadata']) ? [] : Json::decode($styles['metadata']);

  // Hard-code settings for now to limit too many possibilities.
  if ($data) {
    $data['background'] = $this
      ->getStyle('background', $settings);
    $data['media_switch'] = 'media';
    $data['ratio'] = '';
    $data['_detached'] = FALSE;
    $data = array_merge($styles, $data);
    return array_merge(GridStackDefault::entitySettings(), $data);
  }
  return [];
}