Make WordPress Core


Ignore:
Timestamp:
10/22/2018 07:57:07 PM (6 years ago)
Author:
danielbachhuber
Message:

Themes: Introduce responsive embeds support.

Responsive embeds is a way for a theme to opt in to WordPress dynamically scaling the width/height of an embed. When a theme supports responsive embeds, a wp-embed-responsive class is added to the <body> tag. This information is also presented through the REST API for clients to respect.

Props desrosj.
Fixes #45125.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php

    r43735 r43790  
    112112            $data['theme_supports']['formats'] = $formats;
    113113
    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' );
    116117
    117118            if ( $post_thumbnails ) {
     
    157158                    'readonly'    => true,
    158159                    'properties'  => array(
    159                         'formats'         => array(
     160                        'formats'           => array(
    160161                            'description' => __( 'Post formats supported.' ),
    161162                            'type'        => 'array',
    162163                            'readonly'    => true,
    163164                        ),
    164                         'post-thumbnails' => array(
     165                        'post-thumbnails'   => array(
    165166                            'description' => __( 'Whether the theme supports post thumbnails.' ),
    166167                            'type'        => array( 'array', 'bool' ),
     168                            'readonly'    => true,
     169                        ),
     170                        'responsive-embeds' => array(
     171                            'description' => __( 'Whether the theme supports responsive embedded content.', 'gutenberg' ),
     172                            'type'        => 'bool',
    167173                            'readonly'    => true,
    168174                        ),
Note: See TracChangeset for help on using the changeset viewer.