$node->
removeAttribute('data-entity-uuid'
);
$node->
removeAttribute('data-view-mode'
);
$media =
$this->entityRepository->
loadEntityByUuid('media',
$uuid);
assert($media === NULL ||
$media instanceof MediaInterface
);
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
) ?