-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static ST Fields || Dropdown Defaults not populating #531
Comments
Hmm, I suppose it's possible, but I would think this be the responsibility of the Dropdown field to set the default for new fields added to existing blocks. I suppose we need a mechanism to determine whether the field has no value because it's never been saved, or doesn't have a value because the editor has (rightly) not given the field value yet. Otherwise, we'll keep falling over things by setting the default option when none is picked. |
Thanks for the info @engram-design. I was initially wondering if there was an event you could use that fires when a new field gets adding via PC? That, to me, would be a perfect time to check if there's a default value checked. If there is, then just set that default value as the actual value. BK made it somewhat clear that the only times that the default value would get set is if it's Thanks for all that you do! |
The problem with that approach is that it needs to do that on every environment, because adding the field on dev, needs to push content to the element on the environment for dev/staging/prod/etc. There is the concept of We can't use I'll give it some more thought. |
Thanks for the continued thoughts on this as it would be a big help. Could you test if dropdownField == null && if there's a default value checked? Theoretically I think that could work but you're the pro 🎉 I guess I was thinking that PC runs it's migrations on Thanks again! |
Describe the bug
I recently asked Brandon Kelly about this but I think since this issue is only happening within Static SuperTable fields, this is probably a better place.
So I have a bunch of these fields under a Style tab (thank you Matrix Mate!). Inside of that I have a slew of options. Some of those options have Dropdowns with a default value checked.
Like BK said, Craft will only populate those on
new
fields. But the issue is that sometimes I addnew
fields to existing field layouts. The problem with that is then after deployments, I need to manually update those values since they were added to existing field layouts.I know with Craft 4.5 they plan on improving how Craft handles those, but is there anything that can be done within SuperTable to set the initial value to what's Default if the field is empty?
Steps to reproduce
Craft CMS version
4.4.17
Plugin version
3.0.9
Multi-site?
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: