# Plugin Config Media in Frontend-Theme ausgeben

**URL:** <https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811>\
**Category:** Themes & Design\
**Created:** [18. Februar 2020 um 13:25 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811 "2020-02-18T13:25:30Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![FloC3](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FloC3](https://forum.shopware.com/u/FloC3)\
**Post date:** [18. Februar 2020 um 13:25 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/1 "2020-02-18T13:25:30Z")

</div>

Hallo, in meinem Plugin gibt es eine Medienauswahl für ein Icon. Das soll natürlich im Frontend-Theme ausgegeben werden.

was muss ich im Theme TWIG denn machen, um das Bild zu bekommen?

Wenn ich nur die Variable nutze, bekomme ich nur eine UUID:

```
{{ shopware.config.MyPlugin.config.icon1 }}

```

ergibt die ausgabe

```
01c055b8b5274de1b2d156e2e4faed59

```

was mach ich nun damit um eine URL zu meinem Bild zu bekommen?

&nbsp;

außerdem: offenbar gibt es keine Möglichkeit, Variablen anzusehen oder…? {{ debug() }} verursacht Fehler…

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [18. Februar 2020 um 13:44 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/2 "2020-02-18T13:44:42Z")

</div>

Hallo FloC3,

die ID von dem Media kannst du in diese Twig Funktion rein reichen:&nbsp;[Shopware 6: Use custom fields with media type](https://docs.shopware.com/en/shopware-platform-dev-en/how-to/custom-fields-media-type)  
Damit solltest du an das Medien-Objekt mit allen nötigen Informationen kommen.

Viele Grüße aus Schöppingen

![cool](http://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/shopware.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![FloC3](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FloC3](https://forum.shopware.com/u/FloC3)\
**Post date:** [18. Februar 2020 um 14:21 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/3 "2020-02-18T14:21:34Z")

</div>

Hallo [@Michael Telgmann]([http://forum.shopware.com/profile/17553/Michael](http://forum.shopware.com/profile/17553/Michael) Telgmann “Michael Telgmann”)‍,

danke für die Antwort! Leider funktioniert aber der Dump nicht, das heißt ich weiß nicht was ich in dem Objekt “sportsMedia” nun finden kann…

siehe auch meinen letzten Satz im Thread… wieso klappt {{ dump() }} nicht?

![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/1/12fa4dad34032f122958ba1822ea44c867e1ad0a.png)

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [18. Februar 2020 um 14:35 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/4 "2020-02-18T14:35:56Z")

</div>

Hallo,

nutzt du das Dev Template, Production Template oder die ZIP Installation? Ist deine APP\_ENV auf “dev” eingestellt?

Viele Grüße aus Schöppingen

![cool](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/86c57fbace799dd4eb1f1b8a2d3bdc1733f0aea1.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [18. Februar 2020 um 14:52 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/5 "2020-02-18T14:52:07Z")

</div>

Sind die Beispiele dort in Link richtig? Also ich bekomme hier nur Fehlermeldungen:

```
{{{ dump (sportsMedia) }}

```

> Uncaught PHP Exception Twig\Error\SyntaxError: „Unexpected „}“.“

```
{{ dump (sportsMedia) }}

```

> Uncaught PHP Exception Twig\Error\SyntaxError: „Did you forget to run „composer require symfony/debug-bundle“? Unknown function „dump“.“
> 
> &nbsp;

Getestet in der 6.1.1 stable

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [18. Februar 2020 um 14:54 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/6 "2020-02-18T14:54:36Z")

</div>

Hallo R4M,

danke für den Hinweis. Da ist tatsächlich ein kleiner Typo&nbsp; im Code. So sollte es funktionieren:

```
{{ dump(sportsMedia) }}

```

Viele Grüße aus Schöppingen

![cool](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/86c57fbace799dd4eb1f1b8a2d3bdc1733f0aea1.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![FloC3](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FloC3](https://forum.shopware.com/u/FloC3)\
**Post date:** [18. Februar 2020 um 14:55 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/7 "2020-02-18T14:55:43Z")

</div>

ich nutze die ganz normale, öffentlich zum Download verfügbare 6.1.1 stable.&nbsp;

ZIP upload und über den Wizard installiert… ganz normal. Nix mit Dev oder Production oder sowas…

**und nein, der dump funktioniert nicht**. Egal mit wie viel geschweiften Klammern.

auch unabhängig davon, was ich dumpen will…&nbsp;

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [18. Februar 2020 um 14:56 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/8 "2020-02-18T14:56:17Z")

</div>

Geht aber dennoch nicht 🙂 Habt ihr das bei Shopware mal selber ausprobiert?

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [18. Februar 2020 um 15:31 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/9 "2020-02-18T15:31:53Z")

</div>

Hallo,

funktioniert bei mir so einwandfrei:&nbsp;

```
{% sw_extends '@Storefront/storefront/page/product-detail/index.html.twig' %}

{% block page_product_detail %}
    {# simplify access to id #}
    {% set id = shopware.config.PluginConfig.config.pluginMedia %}

    {# fetch media as batch - optimized for performance #}
    {% set media = searchMedia([id], context.context) %}

    {# extract single media object #}
    {% set sportsMedia = media.get(id) %}

    {{ dump(sportsMedia) }}

    {{ parent() }}
{% endblock %}

```

Statt eines Custom Fields habe ich jetzt einen Wert aus einer Plugin Config genommen. Das Prinzip ist aber dasselbe.  
Ausgabe dann in der Storefront:

```
Shopware\Core\Content\Media\MediaEntity {#7136 ▼
  #userId: null
  #mimeType: "image/jpeg"
  #fileExtension: "jpg"
  #fileSize: 16663
  #title: null
  #metaDataRaw: null
  #mediaTypeRaw: "O:47:"Shopware\Core\Content\Media\MediaType\ImageType":3:{s:7:"\x00*\x00name";s:5:"IMAGE";s:8:"\x00*\x00flags";a:0:{}s:13:"\x00*\x00extensions";a:0:{}}"
  #metaData: array:3 [▶]
  #mediaType: Shopware\Core\Content\Media\MediaType\ImageType {#7913 ▶}
  #uploadedAt: DateTimeImmutable @1581608039 {#7472 ▶}
  #alt: null
  #url: "http://shopware.local/media/20/17/4a/1581608039/0f8f758958bf2ca1528c6b3176b58c4f.jpg"
  #fileName: "0f8f758958bf2ca1528c6b3176b58c4f"
  #user: null
  #translations: null
  #categories: null
  #productManufacturers: null
  #productMedia: null
  #avatarUser: null
  #thumbnails: Shopware\Core\Content\Media\Aggregate\MediaThumbnail\MediaThumbnailCollection {#8819 ▶}
  #mediaFolderId: "6f957deea0554e2095389f1a587452b8"
  #mediaFolder: null
  #hasFile: true
  #private: false
  #propertyGroupOptions: null
  #mailTemplateMedia: null
  #customFields: null
  #tags: null
  #thumbnailsRo: "O:77:"Shopware\Core\Content\Media\Aggregate\MediaThumbnail\MediaThumbnailCollection":2:{s:11:"\x00*\x00elements";a:3:{s:32:"22d85a9f44db449796573fb3ef6149a6";O: ▶"
  #documentBaseConfigs: null
  #shippingMethods: null
  #paymentMethods: null
  #productConfiguratorSettings: null
  #orderLineItems: null
  #cmsBlocks: null
  #cmsSections: null
  #cmsPages: null
  #documents: null
  #_uniqueIdentifier: "0232c500795d44728deaea1ab6f01ae5"
  #versionId: null
  #translated: array:3 [▶]
  #createdAt: DateTimeImmutable @1581608039 {#7122 ▶}
  #updatedAt: DateTimeImmutable @1581609070 {#7875 ▶}
  #extensions: array:1 [▶]
  #id: "0232c500795d44728deaea1ab6f01ae5"
}

```

Warum ich nach der installierten Version frage: dump() funktioniert nur, wenn das DebugBundle von Symfony aktiv ist. Dies ist _nicht_ der Fall, wenn ihr z.B. das Production Template oder eben die ZIP Installation nutzt.  
Zum Entwickeln solltet ihr euch das Dev Template aufsetzen:&nbsp;[GitHub - shopware/development](https://github.com/shopware/development)

Viele Grüße aus Schöppingen

![cool](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/86c57fbace799dd4eb1f1b8a2d3bdc1733f0aea1.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![FloC3](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FloC3](https://forum.shopware.com/u/FloC3)\
**Post date:** [18. Februar 2020 um 15:35 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/10 "2020-02-18T15:35:46Z")

</div>

[@Michael Telgmann]([http://forum.shopware.com/profile/17553/Michael](http://forum.shopware.com/profile/17553/Michael) Telgmann “Michael Telgmann”)‍,

sorry wenn ich das so sage… aber das ist Mist.

Ich kann doch nicht für jedes Kundenprojekt ein Dev-Template aufsetzen… für neue Projekte ist das vielleicht noch machbar (wenn auch umständlich), aber für Shops die sich ständig im Wandel befinden absolut nicht tragbar…und ganz ehrlich: ich hab auch keinen Bock mit GIT, Docker und dem anderen Gedöns rumzuhantieren, nur um schnell mal nen neuen Shop aufzusetzen und weiter zu entwickeln… genau dafür gibts doch die ZIP-Downloadversion.

und der “jetzt schon Klassiker” trifft leider wieder zu:&nbsp;in SW5 ging das auch, warum gibts diese ultra basic Funktion nicht in SW6? Sollte das nicht eine Basisfunktion von TWIG sein?

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [18. Februar 2020 um 15:46 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/11 "2020-02-18T15:46:01Z")

</div>

Versuche mal bitte in der „.env“ Datei in deinem Shopware root Verzeichnis den Wert von „APP\_ENV“ auf „dev“ zu stellen. Danach hatte ich ja vorhin schon mal gefragt&nbsp; ![Smile](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/smile.png "Smile")  
Dadurch sollte das DebugBundle aktiviert werden. Ggf. Cache leeren usw.&nbsp;

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [18. Februar 2020 um 15:49 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/12 "2020-02-18T15:49:35Z")

</div>

Ansonsten kann das hier auch helfen:&nbsp;[GitHub - FriendsOfShopware/FroshDevelopmentHelper: Helpful development tools](https://github.com/FriendsOfShopware/FroshDevelopmentHelper)

---

<div class="post-metadata">

**Author:** ![FloC3](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FloC3](https://forum.shopware.com/u/FloC3)\
**Post date:** [18. Februar 2020 um 15:52 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/13 "2020-02-18T15:52:43Z")

</div>

[@Michael Telgmann]([http://forum.shopware.com/profile/17553/Michael](http://forum.shopware.com/profile/17553/Michael) Telgmann „Michael Telgmann“)‍

> Versuche mal bitte in der „.env“ Datei in deinem Shopware root Verzeichnis den Wert von „APP\_ENV“ auf „dev“ zu stellen.&nbsp;

das ist doch eine Lösung, mit der man leben kann! Danke!.

&nbsp;

---

<div class="post-metadata">

**Author:** ![FloC3](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FloC3](https://forum.shopware.com/u/FloC3)\
**Post date:** [19. Februar 2020 um 12:05 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/14 "2020-02-19T12:05:44Z")

</div>

jetzt müsste ich das nur noch in einem Plugin verwenden können, um das Theme zu erweitern… siehe&nbsp;[https://forum.shopware.com/discussion/66164/theme-block-in-plugin-ueberschreiben-wie#latest](https://forum.shopware.com/discussion/66164/theme-block-in-plugin-ueberschreiben-wie#latest)

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [19. Februar 2020 um 13:23 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/15 "2020-02-19T13:23:08Z")

</div>

Meine Fresse, den Hinweis mit dem Wert APP\_ENV muss man erst einmal wissen. Ich dachte dump() wäre schon im Standard vorhanden.

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [19. Februar 2020 um 14:46 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/16 "2020-02-19T14:46:55Z")

</div>

Hallo,

freut mich, dass ich euch helfen konnte&nbsp; ![Smile](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/smile.png "Smile")  
Da Shopware 6 eine Fullstack Symfony Application ist, ist es sicherlich hilfreich, sich erstmal ein bisschen Symfony Basis-Wissen anzueignen. Z.B. über die verschiedenen Environment Einstellungen, die man vornehmen kann:&nbsp;[Configuring Symfony (Symfony Docs)](https://symfony.com/doc/current/configuration.html#configuration-environments)  
und warum „dump()“ in der APP\_ENV=prod eben nicht funktioniert:&nbsp;[The Bundle System (Symfony Bundles Docs)](https://symfony.com/doc/current/bundles.html)&nbsp;[production/bundles.php at 6.1 · shopware/production · GitHub](https://github.com/shopware/production/blob/6.1/config/bundles.php#L10)

Viele Grüße aus Schöppingen

![cool](http://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/shopware.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![FloC3](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FloC3](https://forum.shopware.com/u/FloC3)\
**Post date:** [19. Februar 2020 um 14:56 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/17 "2020-02-19T14:56:12Z")

</div>

kann ich nochmal auf mein Problem hinweisen? Hab leider immer noch kein Statement von Shopware bekommen…&nbsp;[https://forum.shopware.com/discussion/66164/theme-block-in-plugin-ueberschreiben-wie#latest](https://forum.shopware.com/discussion/66164/theme-block-in-plugin-ueberschreiben-wie#latest)

---

<div class="post-metadata">

**Author:** ![FloC3](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FloC3](https://forum.shopware.com/u/FloC3)\
**Post date:** [21. Februar 2020 um 16:09 UTC](https://forum.shopware.com/t/plugin-config-media-in-frontend-theme-ausgeben/64811/18 "2020-02-21T16:09:45Z")

</div>

@\_MikeB‍ also bei mir funktioniert das so:

```
{% set images = searchMedia(mediaIds, context.context) %}

```

wobei **mediaIds** ein Array ist
