-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call variation through callback so it's only loaded when needed - in …
…support of trac 59969 (#56952) * call variation through callback so it's only loaded when needed. * move gutenberg_add_hooked_blocks from 6.4 to 6.5 * cs fixes * fix version number * revert some code * adapting to variation_calback * B/C for plugin * cs fixes * cs fixes * cs fixes * shims to support block variation changes for WP < 6.5 * EOL for PHPCS
- Loading branch information
Showing
6 changed files
with
57 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Temporary compatibility shims for block APIs present in Gutenberg. | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
||
/** | ||
* Shim for the `variation_callback` block type argument. | ||
* | ||
* @param array $args The block type arguments. | ||
* @return array The updated block type arguments. | ||
*/ | ||
function gutenberg_register_block_type_args_shim( $args ) { | ||
if ( isset( $args['variation_callback'] ) && is_callable( $args['variation_callback'] ) ) { | ||
$args['variations'] = call_user_func( $args['variation_callback'] ); | ||
unset( $args['variation_callback'] ); | ||
} | ||
return $args; | ||
} | ||
|
||
if ( ! method_exists( 'WP_Block_Type', 'get_variations' ) ) { | ||
add_filter( 'register_block_type_args', 'gutenberg_register_block_type_args_shim' ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2c247e2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 2c247e2.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7544605769
📝 Reported issues:
/test/e2e/specs/widgets/editing-widgets.spec.js