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

Remove deprecated behaviors syntax #57165

Merged
merged 5 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
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
260 changes: 0 additions & 260 deletions lib/block-supports/behaviors.php

This file was deleted.

27 changes: 0 additions & 27 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,33 +439,6 @@ function gutenberg_legacy_wp_block_post_meta( $value, $object_id, $meta_key, $si

add_filter( 'default_post_metadata', 'gutenberg_legacy_wp_block_post_meta', 10, 4 );

/**
* Complements the lightbox implementation for the 'core/image' block.
*
* This function is INTENTIONALLY left out of core as it only provides
* backwards compatibility for the legacy lightbox syntax that was only
* introduced in Gutenberg. The legacy syntax was using the `behaviors` key in
* the block attrbutes and the `theme.json` file.
*
* @since 16.7.0
*
* @param array $block The block to check.
* @return array The block with the legacyLightboxSettings set if available.
*/
function gutenberg_should_render_lightbox( $block ) {

if ( 'core/image' !== $block['blockName'] ) {
return $block;
}

if ( isset( $block['attrs']['behaviors']['lightbox'] ) ) {
$block['legacyLightboxSettings'] = $block['attrs']['behaviors']['lightbox'];
}

return $block;
}

add_filter( 'render_block_data', 'gutenberg_should_render_lightbox', 15, 1 );

/**
* Registers the metadata block attribute for all block types.
Expand Down
4 changes: 2 additions & 2 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ public function __construct( $theme_json = array(), $origin = 'theme' ) {
$origin = 'theme';
}

$this->theme_json = WP_Theme_JSON_Schema_Gutenberg::migrate( $theme_json );
$this->theme_json = WP_Theme_JSON_Schema::migrate( $theme_json );
$registry = WP_Block_Type_Registry::get_instance();
$valid_block_names = array_keys( $registry->get_all_registered() );
$valid_element_names = array_keys( static::ELEMENTS );
Expand Down Expand Up @@ -2989,7 +2989,7 @@ protected static function filter_slugs( $node, $slugs ) {
public static function remove_insecure_properties( $theme_json ) {
$sanitized = array();

$theme_json = WP_Theme_JSON_Schema_Gutenberg::migrate( $theme_json );
$theme_json = WP_Theme_JSON_Schema::migrate( $theme_json );

$valid_block_names = array_keys( static::get_blocks_metadata() );
$valid_element_names = array_keys( static::ELEMENTS );
Expand Down
Loading
Loading