Changeset 51174
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php
r51049 r51174 211 211 $widget_object = $wp_widget_factory->get_widget_object( $parsed_id['id_base'] ); 212 212 213 $widget['id'] = $parsed_id['id_base']; 214 $widget['is_multi'] = (bool) $widget_object; 213 $widget['id'] = $parsed_id['id_base']; 214 $widget['is_multi'] = (bool) $widget_object; 215 216 if ( isset( $widget['name'] ) ) { 217 $widget['name'] = html_entity_decode( $widget['name'] ); 218 } 219 220 if ( isset( $widget['description'] ) ) { 221 $widget['description'] = html_entity_decode( $widget['description'] ); 222 } 215 223 216 224 unset( $widget['callback'] ); -
trunk/tests/phpunit/tests/rest-api/rest-widget-types-controller.php
r51137 r51174 200 200 201 201 /** 202 * @ticket 53407 203 */ 204 public function test_get_widgets_decodes_html_entities() { 205 wp_set_current_user( self::$admin_id ); 206 $widget_id = 'archives'; 207 wp_register_sidebar_widget( 208 $widget_id, 209 'Legacy ‑ Archive ‑ Widget', 210 function() {}, 211 array( 212 'description' => 'A great & interesting archive of your site’s posts!', 213 ) 214 ); 215 $request = new WP_REST_Request( 'GET', '/wp/v2/widget-types/archives' ); 216 $response = rest_get_server()->dispatch( $request ); 217 $data = $response->get_data(); 218 $this->assertSame( 'Legacy ‑ Archive ‑ Widget', $data['name'] ); 219 $this->assertSame( 'A great & interesting archive of your site’s posts!', $data['description'] ); 220 } 221 222 /** 202 223 * @ticket 41683 203 224 */ … … 493 514 } 494 515 495 496 516 /** 497 517 * The test_create_item() method does not exist for widget types.
Note: See TracChangeset
for help on using the changeset viewer.