if (!
$media) { $this->loggerFactory->
get('media'
)->
error('During rendering of embedded media: the media item with UUID "@uuid" does not exist.',
['@uuid' =>
$uuid]);
} else { $media =
$this->entityRepository->
getTranslationFromContext($media,
$langcode);
$media =
clone $media;
$this->
applyPerEmbedMediaOverrides($node,
$media);
} $view_mode = NULL;
if ($view_mode_id !== EntityDisplayRepositoryInterface::DEFAULT_DISPLAY_MODE
) { $view_mode =
$this->entityRepository->
loadEntityByConfigTarget('entity_view_mode', "media.
$view_mode_id"
);
if (!
$view_mode) { $this->loggerFactory->
get('media'
)->
error('During rendering of embedded media: the view mode "@view-mode-id" does not exist.',
['@view-mode-id' =>
$view_mode_id]);
} } $build =
$media && ($view_mode ||
$view_mode_id === EntityDisplayRepositoryInterface::DEFAULT_DISPLAY_MODE
) ?
$this->
renderMedia($media,
$view_mode_id,
$langcode) :
$this->
renderMissingMediaIndicator();
if (empty($build['#attributes'
]['class'
])) { $build['#attributes'
]['class'
] =
[];
}