You are here

public function AssetImageHelper::getFallbackThumbnail in Media: Acquia DAM 8

Get a fallback image to use for the thumbnail.

Return value

string The Drupal image path to use.

1 call to AssetImageHelper::getFallbackThumbnail()
AssetImageHelper::getThumbnail in src/Service/AssetImageHelper.php
Get the thumbnail for the given asset.

File

src/Service/AssetImageHelper.php, line 210

Class

AssetImageHelper
Class AssetImageHelper.

Namespace

Drupal\media_acquiadam\Service

Code

public function getFallbackThumbnail() {
  $fallback = $this->configFactory
    ->get('media_acquiadam.settings')
    ->get('fallback_thumbnail');

  // There was no configured fallback image, so we should use the one bundled
  // with the module.
  if (empty($fallback)) {

    // @BUG: Can default to any image named webdam.png, not necessarily ours.
    $default_scheme = $this->configFactory
      ->get('system.file')
      ->get('default_scheme');
    $fallback = sprintf('%s://webdam.png', $default_scheme);
    if (!$this
      ->phpFileExists($fallback)) {
      $fallback = $this
        ->setFallbackThumbnail($fallback);
    }
  }
  return $fallback;
}