Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pattern overrides to use a hard coded support array #57912

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/block-supports/pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@
* @param WP_Block_Type $block_type Block Type.
*/
function gutenberg_register_pattern_support( $block_type ) {
global $block_bindings_allowed_blocks;
$pattern_support = array_key_exists( $block_type->name, $block_bindings_allowed_blocks );
// Note that this should be a duplicate or a subset of the $allowed_blocks
// defined in the `process_block_bindings` function.
// It should also match the client side config defined in
// `packages/patterns/src/constants.js`.
$allowed_blocks = array(
'core/paragraph' => array( 'content' ),
'core/heading' => array( 'content' ),
'core/image' => array( 'url', 'title', 'alt' ),
'core/button' => array( 'url', 'text' ),
);
$pattern_support = array_key_exists( $block_type->name, $allowed_blocks );

if ( $pattern_support ) {
if ( ! $block_type->uses_context ) {
Expand Down
Loading