When deleting a page that uses TreeDropdownField, the server issues a 500 error with the following message "[Emergency] Uncaught TypeError: Illegal offset type".
The page is safely deleted.
Steps to reproduce issue
I have the following code.
<?php
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Forms\TreeDropdownField;
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', TreeDropdownField::create('MyPage', 'MyPage', SiteTree::class));
return $fields;
}
}
- I create Page
- I add page to MyPage through the TreeDropdownField
- I publish Page
- I click "Actions menu" and "Unpublish and archive "
- I see error style toast with message "Archived New Page" (in Network tab I see 500 Error with "[Emergency] Uncaught TypeError: Illegal offset type" )
- I refresh page and I see error screen with "Illegal offset type"
- I check DB, page was deleted
## AC's
## PR
Description
When deleting a page that uses TreeDropdownField, the server issues a 500 error with the following message "[Emergency] Uncaught TypeError: Illegal offset type". The page is safely deleted.
Steps to reproduce issue
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Forms\TreeDropdownField;
class Page extends SiteTree { private static $has_one = [ 'MyPage' => SiteTree::class, ];
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', TreeDropdownField::create('MyPage', 'MyPage', SiteTree::class)); return $fields; } }