Skip to content
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

[5.x] Ensure default config values are available in form tag #10088

Merged
merged 9 commits into from
May 15, 2024

Conversation

duncanmcclean
Copy link
Member

This pull request fixes an issue introduced by #9685, where the {{ fields }} array in the form tag doesn't include any fields where the values should be falling back to the fieldtype's defaults.

Example

For example, if you have a text field on your form blueprint and have the "input type" set to text, {{ input_type }} wouldn't output anything on the frontend since the default doesn't actually get saved to the field's config array.

However, if you were to change the "input type" for that field to email, the {{ input_type }} would return correctly on the frontend since the value is being explicitly set in the field's config array.

This PR fixes the issue by merging in the fieldtype's default config values with the field's config values.


Fixes #10077.

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just make Field::toArray() include the defaults?

@duncanmcclean
Copy link
Member Author

duncanmcclean commented May 15, 2024

Why not just make Field::toArray() include the defaults?

I wasn't sure if that'd cause unintended side affects somewhere or not. I've moved it into the Field::toArray() method.

@jasonvarga jasonvarga merged commit ea6ec7d into 5.x May 15, 2024
31 checks passed
@jasonvarga jasonvarga deleted the fix/default-config-values-not-available-in-form-tags branch May 15, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Form blueprint field config is missing default values
2 participants