Last active
March 10, 2020 14:29
-
-
Save Draykee/83f702fa3dee11f1adac19c2630afc6d to your computer and use it in GitHub Desktop.
Shopware 6 TWIG snippet to get media entity from media id in a custom_field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set mediaId = element.customFields["custom_media"] %} | |
{% set searchResult = searchMedia([mediaId], context.context) %} | |
{% set media = searchResult.get(mediaId) %} | |
<img src="{{ media.url }}"> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment