Skip to content

Commit

Permalink
Remove customization for hiding Core's start page options modal (#41324)
Browse files Browse the repository at this point in the history
* Remove update_pattern_block_types

* changelog

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12983958507

Upstream-Ref: Automattic/jetpack@433666b
  • Loading branch information
okmttdhr authored and matticbot committed Jan 27, 2025
1 parent dcdaac7 commit 0a7de77
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 121 deletions.
60 changes: 30 additions & 30 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions jetpack_vendor/automattic/jetpack-mu-wpcom/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ This is an alpha version! The changes listed here are not final.
- Update dependencies.
- Updated package dependencies.

### Deprecated
- Remove customization for the start page options modal

### Removed
- Launchpad: Remove about page task from Newsletter task list
- Reader: Removed daily prompt modal from editor screen.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ public function register_patterns() {
}
}

// We prefer to show the starter page patterns modal of wpcom instead of core
// if it's available. Hence, we have to update the block types of patterns
// to disable the core's.
if ( class_exists( '\A8C\FSE\Starter_Page_Templates', false ) || class_exists( '\Automattic\Jetpack\Jetpack_Mu_Wpcom\Starter_Page_Templates', false ) ) {
$this->update_pattern_block_types();
}

// Temporarily removing the call to `update_pattern_post_types` while we investigate
// https://github.com/Automattic/wp-calypso/issues/79145.

Expand Down Expand Up @@ -205,29 +198,4 @@ private function update_pattern_post_types() {
}
}
}

/**
* Ensure that all patterns with a blockType property are registered with appropriate postTypes.
*/
private function update_pattern_block_types() {
if ( ! class_exists( 'WP_Block_Patterns_Registry' ) ) {
return;
}
foreach ( \WP_Block_Patterns_Registry::get_instance()->get_all_registered() as $pattern ) {
if ( ! array_key_exists( 'blockTypes', $pattern ) || empty( $pattern['blockTypes'] ) ) {
continue;
}

$post_content_offset = array_search( 'core/post-content', $pattern['blockTypes'], true );
$is_page_pattern = empty( $pattern['postTypes'] ) || in_array( 'page', $pattern['postTypes'], true );
if ( $post_content_offset !== false && $is_page_pattern ) {
unregister_block_pattern( $pattern['name'] );

array_splice( $pattern['blockTypes'], $post_content_offset, 1 );
$pattern_name = $pattern['name'];
unset( $pattern['name'] );
register_block_pattern( $pattern_name, $pattern );
}
}
}
}
2 changes: 1 addition & 1 deletion jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
),
'jetpack-mu-wpcom' => array(
'path' => 'jetpack_vendor/automattic/jetpack-mu-wpcom',
'ver' => '6.2.0-alpha1737939553',
'ver' => '6.2.0-alpha1737962597',
),
'jetpack-password-checker' => array(
'path' => 'jetpack_vendor/automattic/jetpack-password-checker',
Expand Down
Loading

0 comments on commit 0a7de77

Please sign in to comment.