I had a moment of confusion with broken Insert Options recently, which made me wonder whether I ever knew the answer behind the issue or whether I'd just forgotten it over the many years I've been working with this CMS. Either way, this needs writing down to help me remember it in the future...
I had merged the latest develop branch for a project I was working on, as I got ready to do a PR for some work. As is my habit in docker-based projects, I restarted my containers with an empty database and did a full sync of serialised data to make sure that the changes to that Unicorn data were correct.
But when I spent some time checking the content tree, I noticed I was missing insert options on one particular item:
But when I went to look at the Data Template for the item, I could see the relevant options:
The
__Standard Values
item has the right settings, and the content item uses the right Data Template.
I'll admit I was a bit confused by this. Why would the correct Data Template not give the correct result? I went through a load of checks, like making sure the item wasn't overriding the data template. But after a while I gave up banging my head against it, and asked my colleague Martin Davies. And he got to have a moment of brilliance by immediately knowing what the issue was:
He said "have you checked the Standard Values field?"
And I had a moment of head scratching. In my head, the
__Standard Values
item was tied to the Data Template by being its child. Why would there be a field for it? But Martin is right - the field is there (Turn on "Show Standard Fields" and look at the end of the "Advanced" section) and it's empty for my broken template:
And when I change the value of that field to link to the correct
__Standard Values
item:
I get my insert options back:
Success!
Well, I'm not sure, to be honest. But my best guess is something merge-related lead to the loss of this value from the serialised Data Template item. So when I did my Unicorn sync, I ended up without this value - even though it should have been there originally. (And was in my database before my merge & sync))
But problem solved, and knowledge gained. So all good...
↑ Back to top