Site tree field always showing as read only

Silverstripe Version: 4.3


I have a link set up between a dataobject (“HomePageListing”) to SiteTree. In the past where I’ve used this, even on v4, the field has been generated without any issues. However, this time the field is appearing as read only and fixed on “Home”.

I’ve even replaced the field through getCMSFields(), but this hasn’t fixed it, it’s still showing as read only.

It’s likely that I’m missing something completely obvious, but any help appreciated.

Here’s an extract of the DataObject file:

    private static $has_one = [
        'Link'          => SiteTree::class

   // I've tried it both with, and without this here
    public function getCMSFields()
        $fields = parent::getCMSFields();
        $fields->replaceField("Link", TreeDropdownField::create("LinkID", "Link to", SiteTree::class));
        return $fields;

Do you have any other relations set up? eg. a $has_many from the HomePage to the DataObject, or anything like that?

1 Like

It does seem that was the case. My error entirely - I set up one relation incorrectly and it was conflicting.

Sometimes you can’t see the wood for trees :roll_eyes:

1 Like