Make WordPress Core


Ignore:
Timestamp:
06/22/2021 09:58:32 AM (4 years ago)
Author:
jorgefilipecosta
Message:

Block Editor: Package updates for Beta 3.

The commit updates the WordPress packages for beta 3.

Props nosolosw, noisysocks, youknowriad.
See #53397.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/legacy-widget.php

    r51089 r51199  
    2525    }
    2626
    27     if ( method_exists( $wp_widget_factory, 'get_widget_object' ) ) {
    28         $widget_object = $wp_widget_factory->get_widget_object( $attributes['idBase'] );
     27    $id_base = $attributes['idBase'];
     28    if ( method_exists( $wp_widget_factory, 'get_widget_key' ) ) {
     29        $widget_key = $wp_widget_factory->get_widget_key( $id_base );
    2930    } else {
    30         $widget_object = gutenberg_get_widget_object( $attributes['idBase'] );
     31        $widget_key = gutenberg_get_widget_key( $id_base );
    3132    }
    3233
    33     if ( ! $widget_object ) {
     34    if ( ! $widget_key ) {
    3435        return '';
    3536    }
     
    4647
    4748    ob_start();
    48     the_widget( get_class( $widget_object ), $instance );
     49    the_widget( $widget_key, $instance );
    4950    return ob_get_clean();
    5051}
     
    9192            /* Reset theme styles */
    9293            html, body, #page, #content {
    93                 background: #FFF !important;
    9494                padding: 0 !important;
    9595                margin: 0 !important;
     
    115115}
    116116
    117 // Ensure handle_legacy_widget_preview_iframe() is called after Core's
    118 // register_block_core_legacy_widget() (priority = 10) and after Gutenberg's
    119 // register_block_core_legacy_widget() (priority = 20).
    120 add_action( 'init', 'handle_legacy_widget_preview_iframe', 21 );
     117// Use admin_init instead of init to ensure get_current_screen function is already available.
     118// This isn't strictly required, but enables better compatibility with existing plugins.
     119// See: https://github.com/WordPress/gutenberg/issues/32624.
     120add_action( 'admin_init', 'handle_legacy_widget_preview_iframe', 20 );
Note: See TracChangeset for help on using the changeset viewer.