cms
cms copied to clipboard
Default values in navigation blueprints don't save
Bug description
When you edit your navigation blueprint and set default values for certain fields, they don't save. So this example:
Will save like this:
-
id: ab914f41-c4d2-4ecc-9f76-5a324347a6a1
title: Hey
It should be:
-
id: ab914f41-c4d2-4ecc-9f76-5a324347a6a1
title: Hey
data:
select: jack
down_under: yeah_nah
addon_devs: sleight
toggle: true
There might be more fields (or simply all) where this happens with, but these are the one I've noticed this behaviour for over time. This behaviour is unwanted when you expect data to be there. A workaround is not to set a default and make the field required.
How to reproduce
Thy this navigation blueprint and add an entry and save it (without touching the fields):
tabs:
main:
display: Main
sections:
-
display: General
fields:
-
handle: select
field:
options:
jack: Jack
jason: Jason
jesse: Jesse
joshua: Joshua
duncan: Duncan
taggable: false
push_tags: false
multiple: false
clearable: false
searchable: true
cast_booleans: false
default: jack
type: select
display: Select
listable: hidden
instructions_position: above
visibility: visible
replicator_preview: true
hide_display: false
-
handle: down_under
field:
options:
yeah_nah: 'Yeah nah'
nah_yeah: 'Nah yeah'
default: yeah_nah
type: button_group
display: 'Down under'
listable: hidden
instructions_position: above
visibility: visible
replicator_preview: true
hide_display: false
-
handle: addon_devs
field:
options:
sleight: Sleight
mitchell: Mitchell
inline: false
cast_booleans: false
default: sleight
type: radio
display: 'Addon devs'
listable: hidden
instructions_position: above
visibility: visible
replicator_preview: true
hide_display: false
-
handle: toggle
field:
inline_label: 'Save me!'
default: true
type: toggle
display: Toggle
listable: hidden
instructions_position: above
visibility: visible
replicator_preview: true
hide_display: false
Logs
No response
Environment
Application Name: Statamic Peak Development
Laravel Version: 10.42.0
PHP Version: 8.3.0
Composer Version: 2.5.5
Environment: local
Debug Mode: ENABLED
URL: statamic-peak.test
Maintenance Mode: OFF
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Addons: 4
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.46.0 PRO
Statamic Addons
studio1902/statamic-peak-browser-appearance: 3.3.4
studio1902/statamic-peak-commands: 5.0.0
studio1902/statamic-peak-seo: 8.0.0
studio1902/statamic-peak-tools: 4.4.0
Installation
Starter Kit using via CLI
Antlers Parser
None
Additional details
No response
The fact the default values aren't being saved to the YAML file here won't be such a big deal in Statamic 5 since they'll automatically pull through in templates (or anywhere else augmentation happens) if no value is set. See #9010.
True but it's still weird that they don't get saved. They should.