Make WordPress Core

Ticket #53481: 53481.patch

File 53481.patch, 1.3 KB (added by imath, 4 years ago)
  • src/wp-includes/blocks/legacy-widget.php

    diff --git src/wp-includes/blocks/legacy-widget.php src/wp-includes/blocks/legacy-widget.php
    index 030aa88f56..d0e4132ac6 100644
    function render_block_core_legacy_widget( $attributes ) { 
    2424                return '';
    2525        }
    2626
    27         $id_base = $attributes['idBase'];
     27        $id_base    = $attributes['idBase'];
     28        $widget_key = '';
    2829        if ( method_exists( $wp_widget_factory, 'get_widget_key' ) ) {
    2930                $widget_key = $wp_widget_factory->get_widget_key( $id_base );
    30         } else {
    31                 $widget_key = gutenberg_get_widget_key( $id_base );
    3231        }
    3332
    3433        if ( ! $widget_key ) {
  • src/wp-includes/class-wp-widget-factory.php

    diff --git src/wp-includes/class-wp-widget-factory.php src/wp-includes/class-wp-widget-factory.php
    index 82eda94e3a..0f0e7ac46c 100644
    class WP_Widget_Factory { 
    120120
    121121                return null;
    122122        }
     123
     124        /**
     125         * Returns the registered key for the given widget type.
     126         *
     127         * @since 5.8.0
     128         *
     129         * @param string $id_base Widget type ID.
     130         * @return string
     131         */
     132        public function get_widget_key( $id_base ) {
     133                foreach ( $this->widgets as $key => $widget_object ) {
     134                        if ( $widget_object->id_base === $id_base ) {
     135                                return $key;
     136                        }
     137                }
     138
     139                return '';
     140        }
    123141}