silverstripe / silverstripe-elemental

Create pages in Silverstripe CMS using content blocks
http://dna.co.nz
BSD 3-Clause "New" or "Revised" License
110 stars 115 forks source link

Issue with nested blocks crashing archive admin #845

Open tractorcow opened 4 years ago

tractorcow commented 4 years ago

With this installed list of dependecies

"silverstripe/recipe-cms": "~4.4.0",
"dnadesign/silverstripe-elemental": "^4.0",
"dnadesign/silverstripe-elemental-list": "^1",

I get this error in archive admin.

[Emergency] Uncaught BadMethodCallException: Object->__call(): the method 'Breadcrumbs' does not exist on 'App\ElementLists\Carousel'
GET /admin/archive/

Caroulsel is an element list.

It looks like the issue is in BlockArchiveExtension (versioned-admin module).

'Breadcrumbs' => function ($val, $item) {
                $parent = $item->Page;

                return $parent ? $parent->Breadcrumbs() : null;
            },

With nested blocks, getPage can return values that aren't actually pages.

Is the blame for this in ArchiveAdmin assuming that ->Page is a page, or is the blame with elemental for returning a non-page value for getPage()?

tractorcow commented 4 years ago

I just hacked in a Breadcrumbs() method that returned null. :)