Skip to content

Commit

Permalink
Block patterns: use category name Testimonials rather than Quotes (#3…
Browse files Browse the repository at this point in the history
…4808)

* Remove unused code

* Revert rename pattern category testimonials to quotes

* changelog

* Remove unused code

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/7383359689
  • Loading branch information
miksansegundo authored and matticbot committed Jan 2, 2024
1 parent 7d9f581 commit 34ae081
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 60 deletions.
8 changes: 4 additions & 4 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 vendor/automattic/jetpack-mu-wpcom/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ This is an alpha version! The changes listed here are not final.
- Add the Sensei setup completion logic
- Fix the start page options modal is still visible

### Changed
- Block patterns: use category name testimonials rather than quotes

## [5.6.0] - 2023-12-25
### Removed
- Remove a nag for domains without a verified email [#34385]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ class Wpcom_Block_Patterns_From_Api {
*/
private $utils;

/**
* A dictionary to map existing WPCOM pattern categories to core patterns.
* These should match the categories in $patterns_sources,
* which are registered in $this->register_patterns()
*
* @var array
*/
private $core_to_wpcom_categories_dictionary;

/**
* Block_Patterns constructor.
*
Expand All @@ -48,14 +39,6 @@ public function __construct( Wpcom_Block_Patterns_Utils $utils = null ) {
$this->patterns_sources = array( 'block_patterns' );

$this->utils = empty( $utils ) ? new Wpcom_Block_Patterns_Utils() : $utils;

// Add categories to this array using the core pattern name as the key for core patterns we wish to "recategorize".
$this->core_to_wpcom_categories_dictionary = array(
'core/quote' => array(
'quotes' => __( 'Quotes', 'jetpack-mu-wpcom' ),
'text' => __( 'Text', 'jetpack-mu-wpcom' ),
),
);
}

/**
Expand Down Expand Up @@ -119,11 +102,6 @@ function ( $a, $b ) {
'Blog Posts',
'jetpack-mu-wpcom'
);
} elseif ( 'testimonials' === $slug ) {
$category_properties['label'] = __(
'Quotes',
'jetpack-mu-wpcom'
);
}
register_block_pattern_category( $slug, $category_properties );
}
Expand Down Expand Up @@ -157,7 +135,6 @@ function ( $a, $b ) {
}
}

$this->update_core_patterns_with_wpcom_categories();
$this->update_pattern_block_types();

// Temporarily removing the call to `update_pattern_post_types` while we investigate
Expand Down Expand Up @@ -251,33 +228,6 @@ private function can_register_pattern( $pattern ) {
return true;
}

/**
* Update categories for core patterns if a records exists in $this->core_to_wpcom_categories_dictionary
* and re-registers them.
*/
private function update_core_patterns_with_wpcom_categories() {
if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
foreach ( \WP_Block_Patterns_Registry::get_instance()->get_all_registered() as $pattern ) {
$wpcom_categories =
$pattern['name'] && isset( $this->core_to_wpcom_categories_dictionary[ $pattern['name'] ] )
? $this->core_to_wpcom_categories_dictionary[ $pattern['name'] ]
: null;
if ( $wpcom_categories ) {
unregister_block_pattern( $pattern['name'] );
$pattern_properties = array_merge(
$pattern,
array( 'categories' => array_keys( $wpcom_categories ) )
);
unset( $pattern_properties['name'] );
register_block_pattern(
$pattern['name'],
$pattern_properties
);
}
}
}
}

/**
* Ensure that all patterns with a blockType property are registered with appropriate postTypes.
*/
Expand Down
6 changes: 3 additions & 3 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"packages": [
{
"name": "automattic/jetpack-mu-wpcom",
"version": "5.7.0-alpha.1704180092",
"version_normalized": "5.7.0.0-alpha1704180092",
"version": "5.7.0-alpha.1704181541",
"version_normalized": "5.7.0.0-alpha1704181541",
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-mu-wpcom",
"reference": "cd634beebd3455b3227b6ab5a44f7b7742954025"
"reference": "e4fb24c25075af0347ec1b005493394996a72227"
},
"require": {
"php": ">=7.0"
Expand Down
6 changes: 3 additions & 3 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
),
'versions' => array(
'automattic/jetpack-mu-wpcom' => array(
'pretty_version' => '5.7.0-alpha.1704180092',
'version' => '5.7.0.0-alpha1704180092',
'reference' => 'cd634beebd3455b3227b6ab5a44f7b7742954025',
'pretty_version' => '5.7.0-alpha.1704181541',
'version' => '5.7.0.0-alpha1704181541',
'reference' => 'e4fb24c25075af0347ec1b005493394996a72227',
'type' => 'jetpack-library',
'install_path' => __DIR__ . '/../automattic/jetpack-mu-wpcom',
'aliases' => array(),
Expand Down

0 comments on commit 34ae081

Please sign in to comment.