Repository navigation
Declare the field properties the runtime reads in the block schema - #191
Merged
Merged
Conversation
The block and extension schemas did not list radio display and allowNull, checkbox toggle, code asset, wysiwyg mode, and repeater default, although the editor and the renderer read them and the docs describe asset and repeater defaults. The default and fallback of color and gradient sat inside their options property instead of on the field. A tooling test checks every field in the test theme against the schema for its type. It also caught the help test block, which used set and subSet instead of sets and subSets.
Contributor
|
Merged and released in Blockstudio 7.7.10. The supported field options are aligned across the schemas, TypeScript definitions, and generated documentation, with regression coverage. Full CI and distribution checks passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Groundwork for #190. Before blockstudio/phpstan can report unknown field properties, the schema has to list every property Blockstudio reads. It did not:
display(buttonGroup)src/blocks/components/fields/components/radio.tsxallowNullradio.tsx, clicking the selected input clears the valuetogglecheckbox.tsx, "select all" checkbox, a string is its labelassetBlock(assetsAsset), documented in Code field assetsmode(code,both)wysiwyg.tsxdefaultdefault,fallbackSelect_Field_Handler::apply_option_defaults()For color and gradient,
defaultandfallbackwere nested inside theoptionsproperty (as if they were keywords of it), so the field-level keys were missing. They now sit on the field and describe what the handler expects: the value of one of the options.Changes:
schemas/block.jsonandschemas/extend.json, in all three places that define the field branches, plusmanifest.jsonchecksums.src/types/block.tsby hand, liketranslatein Add a translate field option to leave fields out of the WPML configuration #180 (npm run typeswould rewrite the whole file).docs/docs/blocks/attributes/field-types.mdregenerated withnpm run docs:generate.scripts/tests/schemas.test.ts(runs intest:tooling): every field intests/thememay only use properties the schema declares for its type. Against the previous schema it lists 59 uses of the properties above; it also found thehelptest block usingsetandsubSetinstead ofsetsandsubSets, fixed here. Thehelpspec only counts help icons, so it is unaffected.Checks run locally:
lint,format:check,typecheck,audit:tooling,docs:check,schemas:check,test:tooling(40 passed). No PHP changes.