Changeset 44138
- Timestamp:
- 12/14/2018 01:49:46 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43790-43791
- Property svn:mergeinfo changed
-
trunk/src/wp-includes/post-template.php
r43576 r44138 759 759 if ( has_custom_logo() ) { 760 760 $classes[] = 'wp-custom-logo'; 761 } 762 763 if ( current_theme_supports( 'responsive-embeds' ) ) { 764 $classes[] = 'wp-embed-responsive'; 761 765 } 762 766 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
r43985 r44138 112 112 $data['theme_supports']['formats'] = $formats; 113 113 114 $data['theme_supports']['post-thumbnails'] = false; 115 $post_thumbnails = get_theme_support( 'post-thumbnails' ); 114 $data['theme_supports']['post-thumbnails'] = false; 115 $data['theme_supports']['responsive-embeds'] = (bool) get_theme_support( 'responsive-embeds' ); 116 $post_thumbnails = get_theme_support( 'post-thumbnails' ); 116 117 117 118 if ( $post_thumbnails ) { … … 157 158 'readonly' => true, 158 159 'properties' => array( 159 'formats' => array(160 'formats' => array( 160 161 'description' => __( 'Post formats supported.' ), 161 162 'type' => 'array', 162 163 'readonly' => true, 163 164 ), 164 'post-thumbnails' => array(165 'post-thumbnails' => array( 165 166 'description' => __( 'Whether the theme supports post thumbnails.' ), 166 167 'type' => array( 'array', 'bool' ), 168 'readonly' => true, 169 ), 170 'responsive-embeds' => array( 171 'description' => __( 'Whether the theme supports responsive embedded content.' ), 172 'type' => 'bool', 167 173 'readonly' => true, 168 174 ), -
trunk/src/wp-includes/theme.php
r43571 r44138 2319 2319 * @since 4.5.0 The `customize-selective-refresh-widgets` feature was added 2320 2320 * @since 4.7.0 The `starter-content` feature was added 2321 * @since 5.0.0 The `responsive-embeds` feature was added. 2321 2322 * 2322 2323 * @global array $_wp_theme_features … … 2324 2325 * @param string $feature The feature being added. Likely core values include 'post-formats', 2325 2326 * 'post-thumbnails', 'html5', 'custom-logo', 'custom-header-uploads', 2326 * 'custom-header', 'custom-background', 'title-tag', 'starter-content', etc. 2327 * 'custom-header', 'custom-background', 'title-tag', 'starter-content', 2328 * 'responsive-embeds', etc. 2327 2329 * @param mixed $args,... Optional extra arguments to pass along with certain features. 2328 2330 * @return void|bool False on failure, void otherwise. -
trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php
r43985 r44138 190 190 $this->assertArrayHasKey( 'theme_supports', $properties ); 191 191 192 $this->assertEquals( 2, count( $properties['theme_supports']['properties'] ) );192 $this->assertEquals( 3, count( $properties['theme_supports']['properties'] ) ); 193 193 $this->assertArrayHasKey( 'formats', $properties['theme_supports']['properties'] ); 194 194 $this->assertArrayHasKey( 'post-thumbnails', $properties['theme_supports']['properties'] ); 195 $this->assertArrayHasKey( 'responsive-embeds', $properties['theme_supports']['properties'] ); 195 196 } 196 197 … … 221 222 $this->assertTrue( isset( $result[0]['theme_supports']['formats'] ) ); 222 223 $this->assertSame( array( 'standard', 'aside', 'video' ), $result[0]['theme_supports']['formats'] ); 224 } 225 226 /** 227 * Test when a theme does not support responsive embeds. 228 * 229 * @ticket 45016 230 */ 231 public function test_theme_supports_responsive_embeds_false() { 232 remove_theme_support( 'responsive-embeds' ); 233 $response = self::perform_active_theme_request(); 234 235 $result = $response->get_data(); 236 $this->assertTrue( isset( $result[0]['theme_supports'] ) ); 237 $this->assertTrue( isset( $result[0]['theme_supports']['responsive-embeds'] ) ); 238 $this->assertFalse( $result[0]['theme_supports']['responsive-embeds'] ); 239 } 240 241 /** 242 * Test when a theme supports responsive embeds. 243 * 244 * @ticket 45016 245 */ 246 public function test_theme_supports_responsive_embeds_true() { 247 remove_theme_support( 'responsive-embeds' ); 248 add_theme_support( 'responsive-embeds' ); 249 $response = self::perform_active_theme_request(); 250 $result = $response->get_data(); 251 $this->assertTrue( isset( $result[0]['theme_supports'] ) ); 252 $this->assertTrue( $result[0]['theme_supports']['responsive-embeds'] ); 223 253 } 224 254 -
trunk/tests/phpunit/tests/theme/support.php
r42343 r44138 193 193 $this->assertFalse( current_theme_supports( 'menus' ) ); 194 194 } 195 196 /** 197 * @ticket 45125 198 */ 199 function test_responsive_embeds() { 200 add_theme_support( 'responsive-embeds' ); 201 $this->assertTrue( current_theme_supports( 'responsive-embeds' ) ); 202 remove_theme_support( 'responsive-embeds' ); 203 $this->assertFalse( current_theme_supports( 'responsive-embeds' ) ); 204 add_theme_support( 'responsive-embeds' ); 205 $this->assertTrue( current_theme_supports( 'responsive-embeds' ) ); 206 } 195 207 }
Note: See TracChangeset
for help on using the changeset viewer.