Skip to content
Snippets Groups Projects
Commit c4c31b98 authored by Eric Bremner's avatar Eric Bremner Committed by Eric Bremner
Browse files

ISTWCMS-4704: coding standards

parent 0a237bb2
No related branches found
No related tags found
1 merge request!112Feature/istwcms 4704 m26lebla ebremner content types
......@@ -7,9 +7,6 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
use Drupal\Core\Url;
use Drupal\file\Entity\File;
use Drupal\image\Entity\ImageStyle;
use Drupal\media\Entity\Media;
use Drupal\node\Entity\Node;
use Drupal\simplify_menu\MenuItems;
use Drupal\path_alias\AliasManager;
......@@ -362,7 +359,7 @@ class UWService implements UWServiceInterface {
if ($mid) {
// Load in the media item.
$media = Media::load($mid[0]['target_id']);
$media = $this->entityTypeManager->getStorage('media')->load($mid[0]['target_id']);
// Get the file id from the media object.
$fid = $media->getSource()->getSourceFieldValue($media);
......@@ -370,8 +367,8 @@ class UWService implements UWServiceInterface {
// If there is a file id, then get the uri,
// using the thumbnail image style.
if ($fid) {
$file = File::load($fid);
$image['uri'] = ImageStyle::load('thumbnail')->buildUrl($file->getFileUri());
$file = $this->entityTypeManager->getStorage('file')->load($fid);
$image['uri'] = $this->entityTypeManager->getStorage('image_style')->load('thumbnail')->buildUrl($file->getFileUri());
$image['alt'] = $media->field_media_image->alt;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment