Skip to content

Commit 70757f7

Browse files
authored
Forms: Fix patterns required indicator issue (#45495)
* Fix default value issue for requiredIndicator This revealed that WordPress was applying the deprecated block schema (INNER_BLOCKS_DEPRECATION) instead of the current one when parsing patterns. When parsing a self-closing field block from a pattern WordPress mathec it against the deprecated schema, which didn't have requiredIndicator defined, so it was stripped out even when explicitly including it in the pattern definition. I've added reqwuiredIndicator to INNER_BLOCKS_DEPRECATION so the deprecated schema recognizes it as valid. * changelog
1 parent 961e304 commit 70757f7

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Forms: fixed a bug that removed the required text from required fields when creating a form from a pattern.

projects/packages/forms/src/blocks/shared/deprecations/inner-blocks-deprecation.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const INNER_BLOCKS_DEPRECATION = {
1414
requiredText: {
1515
type: 'string',
1616
},
17+
requiredIndicator: {
18+
type: 'boolean',
19+
default: true,
20+
},
1721
options: {
1822
type: 'array',
1923
default: [],
@@ -92,6 +96,7 @@ const INNER_BLOCKS_DEPRECATION = {
9296
createBlock( 'jetpack/label', {
9397
label: attributes.label,
9498
requiredText: attributes.requiredText,
99+
requiredIndicator: attributes.requiredIndicator,
95100
style: labelStyles,
96101
} ),
97102
createBlock( 'jetpack/input', {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: bugfix
3+
4+
Forms: fixed a bug that removed the required text from required fields when creating a form from a pattern.

0 commit comments

Comments
 (0)