From 6a5a2acdc959a3792ebdf8c84a76a5f5eeb20acb Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Tue, 16 Dec 2025 16:24:33 +0100 Subject: [PATCH 1/8] scaffolding to add a pattern --- lib/block-patterns.php | 28 ++++++++++++++++++++++++++++ lib/load.php | 1 + 2 files changed, 29 insertions(+) create mode 100644 lib/block-patterns.php diff --git a/lib/block-patterns.php b/lib/block-patterns.php new file mode 100644 index 00000000000000..67cb2916e37224 --- /dev/null +++ b/lib/block-patterns.php @@ -0,0 +1,28 @@ + __( 'Hello World', 'gutenberg' ), + 'description' => _x( 'A simple pattern with a paragraph block saying hello world.', 'Block pattern description', 'gutenberg' ), + 'content' => '

Hello World

', + 'categories' => array( 'text' ), + ) + ); +} +add_action( 'init', 'gutenberg_register_core_block_patterns', 20 ); + diff --git a/lib/load.php b/lib/load.php index 7eb1dfb78a86a0..78fe88098d6fae 100644 --- a/lib/load.php +++ b/lib/load.php @@ -165,6 +165,7 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/class-wp-theme-json-schema-gutenberg.php'; require __DIR__ . '/class-wp-duotone-gutenberg.php'; require __DIR__ . '/blocks.php'; +require __DIR__ . '/block-patterns.php'; require __DIR__ . '/block-editor-settings.php'; require __DIR__ . '/client-assets.php'; require __DIR__ . '/mathml-kses.php'; From eec36ea031c63ac7c0c39003728abb2d3f7e9276 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Wed, 17 Dec 2025 11:11:50 +0100 Subject: [PATCH 2/8] created new category, added better metadata and starting content --- lib/block-patterns.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/block-patterns.php b/lib/block-patterns.php index 67cb2916e37224..862010f9058837 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -14,13 +14,29 @@ * @since 6.0.0 */ function gutenberg_register_core_block_patterns() { + + register_block_pattern_category( + 'navigation', + array( + 'label' => _x( 'Navigation', 'Block pattern category' ), + 'description' => __( 'Display your website navigation.' ), + ) + ); + register_block_pattern( - 'gutenberg/hello-world', + 'gutenberg/navigation-overlay', array( - 'title' => __( 'Hello World', 'gutenberg' ), - 'description' => _x( 'A simple pattern with a paragraph block saying hello world.', 'Block pattern description', 'gutenberg' ), - 'content' => '

Hello World

', - 'categories' => array( 'text' ), + 'title' => __( 'Navigation Overlay', 'gutenberg' ), + 'description' => _x( 'A simple pattern with a navigation block and a navigation overlay close button.', 'Block pattern description', 'gutenberg' ), + 'content' => ' +
+ + + +
+', + 'categories' => array( 'navigation' ), + 'blockTypes' => array( 'core/template-part/overlay' ), ) ); } From 043c91bd7a2958243a62b0832ae40a31effc488c Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Wed, 17 Dec 2025 11:40:02 +0100 Subject: [PATCH 3/8] don't load the patterns if experiment is disabled --- lib/block-patterns.php | 3 +-- lib/load.php | 10 +++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/block-patterns.php b/lib/block-patterns.php index 862010f9058837..a873f0f39bd692 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -14,7 +14,6 @@ * @since 6.0.0 */ function gutenberg_register_core_block_patterns() { - register_block_pattern_category( 'navigation', array( @@ -40,5 +39,5 @@ function gutenberg_register_core_block_patterns() { ) ); } -add_action( 'init', 'gutenberg_register_core_block_patterns', 20 ); +add_action( 'init', 'gutenberg_register_core_block_patterns', 20 ); diff --git a/lib/load.php b/lib/load.php index 78fe88098d6fae..924e2e1d5e322f 100644 --- a/lib/load.php +++ b/lib/load.php @@ -164,9 +164,8 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/class-wp-theme-json-resolver-gutenberg.php'; require __DIR__ . '/class-wp-theme-json-schema-gutenberg.php'; require __DIR__ . '/class-wp-duotone-gutenberg.php'; -require __DIR__ . '/blocks.php'; -require __DIR__ . '/block-patterns.php'; -require __DIR__ . '/block-editor-settings.php'; + require __DIR__ . '/blocks.php'; + require __DIR__ . '/block-editor-settings.php'; require __DIR__ . '/client-assets.php'; require __DIR__ . '/mathml-kses.php'; require __DIR__ . '/demo.php'; @@ -212,3 +211,8 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/experimental/interactivity-api/class-gutenberg-interactivity-api-full-page-navigation.php'; Gutenberg_Interactivity_API_Full_Page_Navigation::instance(); } + +// Block patterns (only load when navigation overlays experiment is enabled). +if ( gutenberg_is_experiment_enabled( 'gutenberg-customizable-navigation-overlays' ) ) { + require __DIR__ . '/block-patterns.php'; +} From 05bb25d840f47d338db055b12d5003f76203ddb3 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Wed, 17 Dec 2025 11:48:34 +0100 Subject: [PATCH 4/8] added text domain and descriptions to translations --- lib/block-patterns.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/block-patterns.php b/lib/block-patterns.php index a873f0f39bd692..b12ca92362aa0c 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -17,8 +17,8 @@ function gutenberg_register_core_block_patterns() { register_block_pattern_category( 'navigation', array( - 'label' => _x( 'Navigation', 'Block pattern category' ), - 'description' => __( 'Display your website navigation.' ), + 'label' => _x( 'Navigation', 'Block pattern category', 'gutenberg' ), + 'description' => _x( 'Display your website navigation.', 'Block pattern category', 'gutenberg' ), ) ); From a5f60f6bab5c29d91f54c004abcbba379c1cfce0 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Wed, 17 Dec 2025 11:49:09 +0100 Subject: [PATCH 5/8] linting --- lib/load.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/load.php b/lib/load.php index 924e2e1d5e322f..e4d00bb82941ef 100644 --- a/lib/load.php +++ b/lib/load.php @@ -164,8 +164,8 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/class-wp-theme-json-resolver-gutenberg.php'; require __DIR__ . '/class-wp-theme-json-schema-gutenberg.php'; require __DIR__ . '/class-wp-duotone-gutenberg.php'; - require __DIR__ . '/blocks.php'; - require __DIR__ . '/block-editor-settings.php'; +require __DIR__ . '/blocks.php'; +require __DIR__ . '/block-editor-settings.php'; require __DIR__ . '/client-assets.php'; require __DIR__ . '/mathml-kses.php'; require __DIR__ . '/demo.php'; From 8ad40f9e9ada3bff7e6761df6a42a503de8bf795 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Wed, 17 Dec 2025 17:02:10 +0100 Subject: [PATCH 6/8] aligned nav close button to the right --- lib/block-patterns.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/block-patterns.php b/lib/block-patterns.php index b12ca92362aa0c..dfd0477a7613a5 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -27,10 +27,12 @@ function gutenberg_register_core_block_patterns() { array( 'title' => __( 'Navigation Overlay', 'gutenberg' ), 'description' => _x( 'A simple pattern with a navigation block and a navigation overlay close button.', 'Block pattern description', 'gutenberg' ), - 'content' => ' -
+ 'content' => ' +
+
- +
+
', From 2199632b2ce6e9d48ab0344b74fd42e20308f8b8 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Thu, 18 Dec 2025 10:55:56 +0100 Subject: [PATCH 7/8] moved file to experimental folder --- .../overlay-patterns.php} | 14 ++++++++------ lib/load.php | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) rename lib/{block-patterns.php => experimental/overlay-patterns.php} (81%) diff --git a/lib/block-patterns.php b/lib/experimental/overlay-patterns.php similarity index 81% rename from lib/block-patterns.php rename to lib/experimental/overlay-patterns.php index dfd0477a7613a5..069dfb15593016 100644 --- a/lib/block-patterns.php +++ b/lib/experimental/overlay-patterns.php @@ -1,19 +1,20 @@ Date: Mon, 5 Jan 2026 18:19:18 +0100 Subject: [PATCH 8/8] removerd extra line --- lib/experimental/overlay-patterns.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/experimental/overlay-patterns.php b/lib/experimental/overlay-patterns.php index 069dfb15593016..0cfb4cbab84d1c 100644 --- a/lib/experimental/overlay-patterns.php +++ b/lib/experimental/overlay-patterns.php @@ -44,4 +44,3 @@ function gutenberg_register_overlay_block_patterns() { } add_action( 'init', 'gutenberg_register_overlay_block_patterns', 20 ); -