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
[Custom fields] Add default value to options #14590
Conversation
c7fa128
to
e3e72a1
Compare
Codecov ReportBase: 59.76% // Head: 49.80% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #14590 +/- ##
==========================================
- Coverage 59.76% 49.80% -9.97%
==========================================
Files 1339 290 -1049
Lines 32669 10184 -22485
Branches 6189 2252 -3937
==========================================
- Hits 19526 5072 -14454
+ Misses 11296 4214 -7082
+ Partials 1847 898 -949
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
...pe-builder/admin/src/components/FormModal/tests/reducer.set-custom-field-data-schema.test.js
Show resolved
Hide resolved
...re/content-type-builder/admin/src/components/FormModal/utils/getCustomFieldDefaultOptions.js
Outdated
Show resolved
Hide resolved
...re/content-type-builder/admin/src/components/FormModal/utils/getCustomFieldDefaultOptions.js
Outdated
Show resolved
Hide resolved
examples/getstarted/src/api/kitchensink/content-types/kitchensink/schema.json
Show resolved
Hide resolved
Test OK |
Hi @markkaylor is this "breaking change" maybe worth mentioning in the patch notes? Context: I was migrating from v4.4.7 to v4.5.6. Also is there a specific reason why this prefix is necessary? |
What does it do?
examples/getstarted
(this will break the admin on 4000 if you add a custom field and then try to access it in the content manager, but I think it is nice to have them to make sure they work in the CTB)defaultValue
key on custom field option objects so that a defaultValue can be set for the optionname
on custom field options object (allowed root level type or prefixed with 'options')Why is it needed?
How to test it?
regex
, check it is pre-filled in the form modalpackages/plugins/color-picker/admin/src/index.js
, and add the following object to theadvanced
array of the custom field registrationregex
, format should be on an options objectpackages/plugins/color-picker/admin/src/index.js
and changename: 'options.format'
toname: 'format'
, save and go back to the admin, you should have an error.