You are here

public static function BlazyMedia::getMediaSettings in Blazy 7

Returns the {file_display} settings for the file type and view mode.

1 call to BlazyMedia::getMediaSettings()
BlazyMedia::getMediaData in src/BlazyMedia.php
Returns the preprocessed/ formatted variables based on media settings.

File

src/BlazyMedia.php, line 174

Class

BlazyMedia
Provides extra utilities to work with Media.

Namespace

Drupal\blazy

Code

public static function getMediaSettings(array $settings = []) {
  ctools_include('export');
  $formatter = 'media_' . $settings['scheme'] . '_' . $settings['type'];
  $name = $settings['type'] . '__' . $settings['view_mode'] . '__' . $formatter;

  // Example: `video__slick_carousel__media_youtube_video`.
  $displays = ctools_export_load_object('file_display', 'names', [
    $name,
  ]);
  return $displays[$name] ? $displays[$name]->settings : FALSE;
}