Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions projects/packages/forms/changelog/add-core-blocks-to-forms
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Allow Accordion, Details, and Icon blocks in forms.
4 changes: 4 additions & 0 deletions projects/packages/forms/changelog/allow-icon-in-dropzone
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

File Upload Dropzone: Allow Icon block to be added inside the dropzone.
1 change: 1 addition & 0 deletions projects/packages/forms/src/blocks/dropzone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const settings = {
allowedBlocks: [
'core/button',
'core/heading',
'core/icon',
'core/image',
'core/list',
'core/paragraph',
Expand Down
3 changes: 3 additions & 0 deletions projects/packages/forms/src/blocks/shared/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ export const ALLOWED_FORMATS = [ 'core/bold', 'core/italic' ];
export const ALLOWED_INNER_BLOCKS = [ 'jetpack/label', 'jetpack/input' ];

export const CORE_BLOCKS = [
'core/accordion',
'core/audio',
'core/code',
'core/columns',
'core/details',
'core/group',
'core/heading',
'core/html',
'core/icon',
'core/image',
'core/list',
'core/math',
Expand Down
12 changes: 7 additions & 5 deletions projects/packages/forms/src/form-editor/class-form-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public static function allowed_blocks_for_jetpack_form( $allowed_block_types, $e
'jetpack/field-image-select',

// Supporting blocks.
'jetpack/button',
'core/button',
'jetpack/button', // Used for the submit button previously.
'jetpack/label',
'jetpack/input',
'jetpack/options',
Expand All @@ -96,17 +95,20 @@ public static function allowed_blocks_for_jetpack_form( $allowed_block_types, $e
'jetpack/form-progress-indicator',

// Core blocks for rich content.
'core/accordion',
'core/audio',
'core/button',
'core/button', // Used for the submit button.
Comment on lines 78 to +100
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The inline comments about which block is used for the submit button are misleading/inconsistent. The form editor still programmatically creates a jetpack/button submit button (see projects/packages/forms/src/form-editor/index.tsx), while this list claims core/button is used for submit and jetpack/button was only used previously. Consider rewording these comments to reflect that both jetpack/button (legacy) and core/button (current) may exist for backwards compatibility, or remove the submit-button-specific wording altogether.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

@simison simison Feb 13, 2026

Choose a reason for hiding this comment

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

@enejb, can you check if the above is true, and we need to update it to use the core button instead if it is.

(Let's keep the comment as-is.)

'core/code',
Comment on lines 97 to 101
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The allowed core block list for the form CPT was expanded here, but the existing PHPUnit coverage for Form_Editor::allowed_blocks_for_jetpack_form() doesn’t assert any of these newly-allowed blocks. Please update projects/packages/forms/tests/php/form-editor/Form_Editor_Test.php::test_allowed_blocks_for_jetpack_form_restricts_blocks to include assertions for core/accordion, core/details, and core/icon so future regressions are caught.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is legit and low effort.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

'core/columns',
'core/column',
'core/columns',
'core/details',
'core/group',
'core/heading',
'core/html',
'core/icon',
'core/image',
'core/list',
'core/list-item',
'core/list',
'core/math',
'core/paragraph',
'core/row',
Expand Down
35 changes: 29 additions & 6 deletions projects/packages/forms/tests/php/form-editor/Form_Editor_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public function test_allowed_blocks_for_jetpack_form_restricts_blocks() {
// Verify that core blocks are in the allowed list
$this->assertContains( 'core/paragraph', $result, 'Paragraph block should be allowed' );
$this->assertContains( 'core/heading', $result, 'Heading block should be allowed' );
$this->assertContains( 'core/accordion', $result, 'Accordion block should be allowed' );
$this->assertContains( 'core/details', $result, 'Details block should be allowed' );
$this->assertContains( 'core/icon', $result, 'Icon block should be allowed' );

// Verify that contact-form block is NOT in the list (handled by DOM manipulation)
$this->assertNotContains( 'jetpack/contact-form', $result, 'Contact form block should not be in the allowed list' );
Expand Down Expand Up @@ -410,7 +413,11 @@ public function test_allowed_blocks_list_completeness() {
'jetpack/field-rating',
'jetpack/field-text',
'jetpack/field-number',
'jetpack/field-hidden',
'jetpack/field-file',
'jetpack/field-time',
'jetpack/field-slider',
'jetpack/field-image-select',
);

// Expected blocks - supporting blocks
Expand All @@ -421,6 +428,11 @@ public function test_allowed_blocks_list_completeness() {
'jetpack/options',
'jetpack/option',
'jetpack/phone-input',
'jetpack/dropzone',
'jetpack/input-range',
'jetpack/input-rating',
'jetpack/fieldset-image-options',
'jetpack/input-image-option',
);

// Expected blocks - multistep blocks
Expand All @@ -434,17 +446,28 @@ public function test_allowed_blocks_list_completeness() {

// Expected blocks - core blocks
$expected_core_blocks = array(
'core/paragraph',
'core/accordion',
'core/audio',
'core/button',
'core/code',
'core/column',
'core/columns',
'core/details',
'core/group',
'core/heading',
'core/html',
'core/icon',
'core/image',
'core/list',
'core/list-item',
'core/math',
'core/paragraph',
'core/row',
'core/separator',
'core/spacer',
'core/columns',
'core/column',
'core/group',
'core/image',
'core/html',
'core/stack',
'core/subhead',
'core/video',
);

// Verify all expected blocks are present
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

Forms: Allow Accordion, Details, and Icon blocks in forms, and Icon block to be added inside the file upload dropzone.
Loading