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 ) { |
| 24 | 24 | return ''; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | | $id_base = $attributes['idBase']; |
| | 27 | $id_base = $attributes['idBase']; |
| | 28 | $widget_key = ''; |
| 28 | 29 | if ( method_exists( $wp_widget_factory, 'get_widget_key' ) ) { |
| 29 | 30 | $widget_key = $wp_widget_factory->get_widget_key( $id_base ); |
| 30 | | } else { |
| 31 | | $widget_key = gutenberg_get_widget_key( $id_base ); |
| 32 | 31 | } |
| 33 | 32 | |
| 34 | 33 | if ( ! $widget_key ) { |
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 { |
| 120 | 120 | |
| 121 | 121 | return null; |
| 122 | 122 | } |
| | 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 | } |
| 123 | 141 | } |