diff --git a/lib/compat/wordpress-6.1/block-patterns.php b/lib/compat/wordpress-6.1/block-patterns.php index 4d1724323b1dc2..7860aa6a1dd661 100644 --- a/lib/compat/wordpress-6.1/block-patterns.php +++ b/lib/compat/wordpress-6.1/block-patterns.php @@ -175,59 +175,3 @@ function gutenberg_register_theme_block_patterns() { } remove_action( 'init', '_register_theme_block_patterns' ); add_action( 'init', 'gutenberg_register_theme_block_patterns' ); - -/** - * Registers Gutenberg-bundled patterns, with a focus on headers and footers - * for site editing. - * - * @since 6.1.0 - * @access private - */ -function gutenberg_register_core_block_patterns() { - $should_register_core_patterns = get_theme_support( 'core-block-patterns' ); - - // Register categories used for block patterns. - $pattern_category_registry = WP_Block_Pattern_Categories_Registry::get_instance(); - - if ( ! $pattern_category_registry->is_registered( 'footer' ) ) { - register_block_pattern_category( 'footer', array( 'label' => __( 'Footers', 'gutenberg' ) ) ); - } - - if ( ! $pattern_category_registry->is_registered( 'banner' ) ) { - register_block_pattern_category( 'banner', array( 'label' => __( 'Banners', 'gutenberg' ) ) ); - } - - if ( $should_register_core_patterns ) { - $core_block_patterns = array( - 'centered-footer', - 'centered-footer-with-social-links', - 'centered-header', - 'centered-logo-in-navigation', - 'footer-with-background-color-and-three-columns', - 'footer-with-credit-line-and-navigation', - 'footer-with-large-font-size', - 'footer-with-navigation-and-credit-line', - 'footer-with-search-site-title-and-credit-line', - 'footer-with-site-title-and-credit-line', - 'header-with-large-font-size', - 'left-aligned-footer', - 'right-aligned-footer', - 'simple-header', - 'simple-header-inside-image', - 'simple-header-with-background-color', - 'simple-header-with-image', - 'simple-header-with-tagline', - 'simple-header-with-tagline-2', - 'site-title-and-menu-button', - 'site-title-and-vertical-navigation', - ); - - foreach ( $core_block_patterns as $core_block_pattern ) { - register_block_pattern( - 'core/' . $core_block_pattern, - require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php' - ); - } - } -} -add_action( 'init', 'gutenberg_register_core_block_patterns' ); diff --git a/lib/compat/wordpress-6.2/block-patterns.php b/lib/compat/wordpress-6.2/block-patterns.php index c06b385b7cc2c8..a28566d441e7a8 100644 --- a/lib/compat/wordpress-6.2/block-patterns.php +++ b/lib/compat/wordpress-6.2/block-patterns.php @@ -9,6 +9,12 @@ * Registers the block pattern categories REST API routes. */ function gutenberg_register_core_block_patterns_and_categories() { + register_block_pattern_category( + 'banner', + array( + 'label' => _x( 'Banners', 'Block pattern category', 'gutenberg' ), + ) + ); register_block_pattern_category( 'buttons', array( @@ -60,3 +66,48 @@ function gutenberg_register_core_block_patterns_and_categories() { ); } add_action( 'init', 'gutenberg_register_core_block_patterns_and_categories' ); + +/** + * Registers Gutenberg-bundled patterns, with a focus on headers and footers + * for site editing. + * + * @since 6.2.0 + * @access private + */ +function gutenberg_register_core_block_patterns() { + if ( ! get_theme_support( 'core-block-patterns' ) ) { + return; + } + + $core_block_patterns = array( + 'centered-footer', + 'centered-footer-with-social-links', + 'centered-header', + 'centered-logo-in-navigation', + 'footer-with-background-color-and-three-columns', + 'footer-with-credit-line-and-navigation', + 'footer-with-large-font-size', + 'footer-with-navigation-and-credit-line', + 'footer-with-search-site-title-and-credit-line', + 'footer-with-site-title-and-credit-line', + 'header-with-large-font-size', + 'left-aligned-footer', + 'right-aligned-footer', + 'simple-header', + 'simple-header-inside-image', + 'simple-header-with-background-color', + 'simple-header-with-image', + 'simple-header-with-tagline', + 'simple-header-with-tagline-2', + 'site-title-and-menu-button', + 'site-title-and-vertical-navigation', + ); + + foreach ( $core_block_patterns as $core_block_pattern ) { + register_block_pattern( + 'core/' . $core_block_pattern, + require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php' + ); + } +} +add_action( 'init', 'gutenberg_register_core_block_patterns' ); diff --git a/lib/compat/wordpress-6.1/block-patterns/centered-footer-with-social-links.php b/lib/compat/wordpress-6.2/block-patterns/centered-footer-with-social-links.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/centered-footer-with-social-links.php rename to lib/compat/wordpress-6.2/block-patterns/centered-footer-with-social-links.php diff --git a/lib/compat/wordpress-6.1/block-patterns/centered-footer.php b/lib/compat/wordpress-6.2/block-patterns/centered-footer.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/centered-footer.php rename to lib/compat/wordpress-6.2/block-patterns/centered-footer.php diff --git a/lib/compat/wordpress-6.1/block-patterns/centered-header.php b/lib/compat/wordpress-6.2/block-patterns/centered-header.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/centered-header.php rename to lib/compat/wordpress-6.2/block-patterns/centered-header.php diff --git a/lib/compat/wordpress-6.1/block-patterns/centered-logo-in-navigation.php b/lib/compat/wordpress-6.2/block-patterns/centered-logo-in-navigation.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/centered-logo-in-navigation.php rename to lib/compat/wordpress-6.2/block-patterns/centered-logo-in-navigation.php diff --git a/lib/compat/wordpress-6.1/block-patterns/footer-with-background-color-and-three-columns.php b/lib/compat/wordpress-6.2/block-patterns/footer-with-background-color-and-three-columns.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/footer-with-background-color-and-three-columns.php rename to lib/compat/wordpress-6.2/block-patterns/footer-with-background-color-and-three-columns.php diff --git a/lib/compat/wordpress-6.1/block-patterns/footer-with-credit-line-and-navigation.php b/lib/compat/wordpress-6.2/block-patterns/footer-with-credit-line-and-navigation.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/footer-with-credit-line-and-navigation.php rename to lib/compat/wordpress-6.2/block-patterns/footer-with-credit-line-and-navigation.php diff --git a/lib/compat/wordpress-6.1/block-patterns/footer-with-large-font-size.php b/lib/compat/wordpress-6.2/block-patterns/footer-with-large-font-size.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/footer-with-large-font-size.php rename to lib/compat/wordpress-6.2/block-patterns/footer-with-large-font-size.php diff --git a/lib/compat/wordpress-6.1/block-patterns/footer-with-navigation-and-credit-line.php b/lib/compat/wordpress-6.2/block-patterns/footer-with-navigation-and-credit-line.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/footer-with-navigation-and-credit-line.php rename to lib/compat/wordpress-6.2/block-patterns/footer-with-navigation-and-credit-line.php diff --git a/lib/compat/wordpress-6.1/block-patterns/footer-with-search-site-title-and-credit-line.php b/lib/compat/wordpress-6.2/block-patterns/footer-with-search-site-title-and-credit-line.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/footer-with-search-site-title-and-credit-line.php rename to lib/compat/wordpress-6.2/block-patterns/footer-with-search-site-title-and-credit-line.php diff --git a/lib/compat/wordpress-6.1/block-patterns/footer-with-site-title-and-credit-line.php b/lib/compat/wordpress-6.2/block-patterns/footer-with-site-title-and-credit-line.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/footer-with-site-title-and-credit-line.php rename to lib/compat/wordpress-6.2/block-patterns/footer-with-site-title-and-credit-line.php diff --git a/lib/compat/wordpress-6.1/block-patterns/header-with-large-font-size.php b/lib/compat/wordpress-6.2/block-patterns/header-with-large-font-size.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/header-with-large-font-size.php rename to lib/compat/wordpress-6.2/block-patterns/header-with-large-font-size.php diff --git a/lib/compat/wordpress-6.1/block-patterns/left-aligned-footer.php b/lib/compat/wordpress-6.2/block-patterns/left-aligned-footer.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/left-aligned-footer.php rename to lib/compat/wordpress-6.2/block-patterns/left-aligned-footer.php diff --git a/lib/compat/wordpress-6.1/block-patterns/right-aligned-footer.php b/lib/compat/wordpress-6.2/block-patterns/right-aligned-footer.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/right-aligned-footer.php rename to lib/compat/wordpress-6.2/block-patterns/right-aligned-footer.php diff --git a/lib/compat/wordpress-6.1/block-patterns/simple-header-inside-image.php b/lib/compat/wordpress-6.2/block-patterns/simple-header-inside-image.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/simple-header-inside-image.php rename to lib/compat/wordpress-6.2/block-patterns/simple-header-inside-image.php diff --git a/lib/compat/wordpress-6.1/block-patterns/simple-header-with-background-color.php b/lib/compat/wordpress-6.2/block-patterns/simple-header-with-background-color.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/simple-header-with-background-color.php rename to lib/compat/wordpress-6.2/block-patterns/simple-header-with-background-color.php diff --git a/lib/compat/wordpress-6.1/block-patterns/simple-header-with-image.php b/lib/compat/wordpress-6.2/block-patterns/simple-header-with-image.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/simple-header-with-image.php rename to lib/compat/wordpress-6.2/block-patterns/simple-header-with-image.php diff --git a/lib/compat/wordpress-6.1/block-patterns/simple-header-with-tagline-2.php b/lib/compat/wordpress-6.2/block-patterns/simple-header-with-tagline-2.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/simple-header-with-tagline-2.php rename to lib/compat/wordpress-6.2/block-patterns/simple-header-with-tagline-2.php diff --git a/lib/compat/wordpress-6.1/block-patterns/simple-header-with-tagline.php b/lib/compat/wordpress-6.2/block-patterns/simple-header-with-tagline.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/simple-header-with-tagline.php rename to lib/compat/wordpress-6.2/block-patterns/simple-header-with-tagline.php diff --git a/lib/compat/wordpress-6.1/block-patterns/simple-header.php b/lib/compat/wordpress-6.2/block-patterns/simple-header.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/simple-header.php rename to lib/compat/wordpress-6.2/block-patterns/simple-header.php diff --git a/lib/compat/wordpress-6.1/block-patterns/site-title-and-menu-button.php b/lib/compat/wordpress-6.2/block-patterns/site-title-and-menu-button.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/site-title-and-menu-button.php rename to lib/compat/wordpress-6.2/block-patterns/site-title-and-menu-button.php diff --git a/lib/compat/wordpress-6.1/block-patterns/site-title-and-vertical-navigation.php b/lib/compat/wordpress-6.2/block-patterns/site-title-and-vertical-navigation.php similarity index 100% rename from lib/compat/wordpress-6.1/block-patterns/site-title-and-vertical-navigation.php rename to lib/compat/wordpress-6.2/block-patterns/site-title-and-vertical-navigation.php