statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
31 stars 1 forks source link

Fieldset updates don't update dependencies (e.g. the pages it is used in) #782

Open torian257x opened 2 years ago

torian257x commented 2 years ago

lets say I have a fieldset called

"section"

section has a field color. I create 100 pages using sections, with different colors

now I add a new field to section, called "padding-top" with a default value of lets say padding-xl

after saving, none of the pages has this default value set, but all have null.

it would be vital to have a way to propagate these default values to its dependencies, otherwise you have to duplicate the default-value logic into your code. Does that make sense?

an easy solution would probably be a command that sets all default values if they are missing

jasonvarga commented 2 years ago

The default (at the moment, at least) just sets the default for the field when used in the control panel.

If you want an actual default value, you can add it to the collection. It'll be available to all entries, unless overridden.

# content/collections/blog.yaml

inject:
  color: '#000000'