# CMS Elemente filtern

**URL:** https://forum.shopware.com/t/cms-elemente-filtern/93581
**Category:** Programmierung
**Created:** [21. März 2022 um 14:42 UTC](https://forum.shopware.com/t/cms-elemente-filtern/93581 "2022-03-21T14:42:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)
#### Post date: [21. März 2022 um 14:42 UTC](https://forum.shopware.com/t/cms-elemente-filtern/93581/1 "2022-03-21T14:42:36Z")

</div>

Hallo,

gibt es eine Möglichkeit, den Inhalt der CMS-Elemente zu filtern?  
Z.b. möchte in der Storefront allen `h2` Elementen ein Attribut hinzufügen. Ist das irgendwie machbar?

---

<div class="post-metadata">

### Author: ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)
#### Post date: [21. März 2022 um 19:47 UTC](https://forum.shopware.com/t/cms-elemente-filtern/93581/2 "2022-03-21T19:47:21Z")

</div>

Per JavaScript sollte das kein Problem darstellen. Die CMS-Elemente sind ja in einem Wrapper eingepackt. Im Backend ohne Plugin wohl nicht möglich.

---

<div class="post-metadata">

### Author: ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)
#### Post date: [22. März 2022 um 06:11 UTC](https://forum.shopware.com/t/cms-elemente-filtern/93581/3 "2022-03-22T06:11:29Z")

</div>

Per Plugin ist schon klar. Kann man vielleicht den `TextCmsElementResolver` decoraten/subscriben/irgendwas?

---

<div class="post-metadata">

### Author: ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)
#### Post date: [22. März 2022 um 07:52 UTC](https://forum.shopware.com/t/cms-elemente-filtern/93581/4 "2022-03-22T07:52:41Z")

</div>

```xml

        <service id="Axgx\SuperNiceTheme\Core\Content\Cms\DataResolver\Element\TextCmsElementResolver"
                 decorates="Shopware\Core\Content\Cms\DataResolver\Element\TextCmsElementResolver">
            <argument type="service"
                      id="Axgx\SuperNiceTheme\Core\Content\Cms\DataResolver\Element\TextCmsElementResolver.inner" />
        </service>

```

So geht’s, hätte ich auch gleich probieren können 😅
