dnadesign / silverstripe-elemental-virtual

Allows Content Blocks to be reused between pages.
BSD 3-Clause "New" or "Revised" License
7 stars 26 forks source link

Virtualising an ElementList causes the CMS ElementArea to fail to render #28

Open jules0x opened 5 years ago

jules0x commented 5 years ago

When trying to virtualise an ElementList, I've found that the CMS ElementArea for that page will no longer render once you save the virtual element. The front-end does show the element successfully, but the elements on the page are no longer accessible in the CMS.

https://reactjs.org/docs/error-decoder.html/?invariant=31&args[]=object%20with%20keys%20%7B%7D&args[]= Objects are not valid as a React child (found: object with keys {}).

SS 4.4.0 Elemental 4.1.1 Element Virtual 1.2.2

jules0x commented 5 years ago

Looks to be the protected provideBlockSchema() function on ElementVirtual.php

Overriding the function on my custom virtual element as below resolves the issue

    protected function provideBlockSchema()
    {
        $blockSchema = parent::provideBlockSchema();
        unset($blockSchema['content']);
        return $blockSchema;
    }