You are here

public function CommonUtilities::fileLoad in Convert Media Tags to Markup 8

Same name and namespace in other branches
  1. 2.x src/traits/CommonUtilities.php \Drupal\convert_media_tags_to_markup\traits\CommonUtilities::fileLoad()

Mockable wrapper around File::load(). Also throws an exception.

1 call to CommonUtilities::fileLoad()
App::tokenToMarkup in src/ConvertMediaTagsToMarkup/App.php
Replace callback to convert a media file tag into HTML markup.

File

src/traits/CommonUtilities.php, line 37

Class

CommonUtilities
General utilities trait.

Namespace

Drupal\convert_media_tags_to_markup\traits

Code

public function fileLoad($fid) {
  $file = File::load($fid);
  if (!$file) {
    throw new \Exception('Could not load media object');
  }
  return $file;
}