# Fehler beim speichern einens custom Blocks in der Administration

**URL:** <https://forum.shopware.com/t/fehler-beim-speichern-einens-custom-blocks-in-der-administration/68149>\
**Category:** Programmierung\
**Created:** [6. Juli 2020 um 09:29 UTC](https://forum.shopware.com/t/fehler-beim-speichern-einens-custom-blocks-in-der-administration/68149 "2020-07-06T09:29:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![levinnivel](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@levinnivel](https://forum.shopware.com/u/levinnivel)\
**Post date:** [6. Juli 2020 um 09:29 UTC](https://forum.shopware.com/t/fehler-beim-speichern-einens-custom-blocks-in-der-administration/68149/1 "2020-07-06T09:29:47Z")

</div>

Hallo zusammen.

Ich habe einen Custom Block in meinem Theme Plugin erstellt. Die Ausgabe der Preview und des Components funktioniert im Admin aber wenn ich versuche meine Erlebniswelt zu speichern, passiert nichts und dieser Fehler tritt in der der Konsole auf:

```
vendors-node.js?15940248011367633:2 TypeError: Cannot convert undefined or null to object
    at Function.values ()
    at s.checkRequiredSlotConfigField (app.js?15940248014372417:1)
    at app.js?15940248014372417:1
    at Array.forEach ()
    at app.js?15940248014372417:1
    at Array.forEach ()
    at app.js?15940248014372417:1
    at Array.forEach ()
    at s.onSave (app.js?15940248014372417:1)
    at Xe (vendors-node.js?15940248011367633:2)

```

Der Inhalt meiner index.js sieht so aus:

```
import './component';
import './preview';

const {Application} = Shopware;

Shopware.Service('cmsService').registerCmsBlock({
    name: 'category-view',
    label: 'sw-cms.blocks.commerce.categoryView.label',
    category: 'commerce',
    component: 'sw-cms-block-category-view',
    previewComponent: 'sw-cms-preview-category-view',
    defaultConfig: {
        marginBottom: '20px',
        marginTop: '20px',
        marginLeft: '20px',
        marginRight: '20px',
        sizingMode: 'boxed'
    },
    slots: {
        content: 'category-view'
    }
});

```

Danke für eure Hilfe!

---

<div class="post-metadata">

**Author:** ![iTiOusIT](https://avatars.discourse-cdn.com/v4/letter/i/b19c9b/32.png) [@iTiOusIT](https://forum.shopware.com/u/iTiOusIT)\
**Post date:** [23. September 2020 um 09:19 UTC](https://forum.shopware.com/t/fehler-beim-speichern-einens-custom-blocks-in-der-administration/68149/2 "2020-09-23T09:19:51Z")

</div>

Nur ne Vermutung, aber hast du den slot content auch im component Template definiert? Daran lag es nämlich&nbsp;bei mir.

---

<div class="post-metadata">

**Author:** ![Leoffelmann](https://avatars.discourse-cdn.com/v4/letter/l/eb8c5e/32.png) [@Leoffelmann](https://forum.shopware.com/u/Leoffelmann)\
**Post date:** [1. Oktober 2020 um 14:38 UTC](https://forum.shopware.com/t/fehler-beim-speichern-einens-custom-blocks-in-der-administration/68149/3 "2020-10-01T14:38:30Z")

</div>

Hatte das selbe Problem. Du musst wenn du die slots angibst die default data und config angeben.

```
slots: {
        //Name
        "content": {
            type:"category-view",
            default:{
                config:{
                    //Deine Default Config
                },
                data:{
                    //Deine Default Data
                }
            }
        }
    }

```

Edit: Lag doch nicht daran du benutzt warscheinlich ein custom element wenn du dieses regestrierst MUSST du eine defaultConfig angeben also:

```
import './preview';
import "./component"

Shopware.Service('cmsService').registerCmsElement({
    name: 'elementName',
    label: 'sw-cms.elements.elementName.label',
    component: 'sw-cms-el-elementName-list',
    previewComponent: 'sw-cms-el-preview-elementName-list',
    
    //der wichtige teil den ich vergessen habe...
    defaultConfig: {
    }
});

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![Jo\_von\_Nimbits](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/jo_von_nimbits/32/14430_2.png) [@Jo\_von\_Nimbits](https://forum.shopware.com/u/Jo_von_Nimbits)\
**Post date:** [3. März 2021 um 15:03 UTC](https://forum.shopware.com/t/fehler-beim-speichern-einens-custom-blocks-in-der-administration/68149/4 "2021-03-03T15:03:35Z")

</div>

Mein Kollege hatten den Fehler auch. Lag daran, dass wir in der defaultConfig ein Attribut hatten, was wir dann später gelöscht haben. Die Seite hat allerdings dann immer noch das alte Attribut erwartet bzw. irgend einen Unfug mit dem Inhalt getrieben.

**Lösung:** Erlebniswelt löschen → Neue anlegen 😉
