Make WordPress Core


Ignore:
Timestamp:
06/25/2021 03:50:14 PM (4 years ago)
Author:
youknowriad
Message:

Block Editor: Update the packages with a number of fixes targeted for Beta 4.

It includes fixes from these two backport PRs:

Props gziolo, ryelle, ntsekouras, desrosj, jorgefilipecosta.
See #53397

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r50840 r51241  
    12291229        $response->add_link( 'help', 'https://developer.wordpress.org/rest-api/' );
    12301230        $this->add_active_theme_link_to_index( $response );
     1231        $this->add_site_logo_to_index( $response );
    12311232
    12321233        /**
     
    12701271            $theme = wp_get_theme();
    12711272            $response->add_link( 'https://api.w.org/active-theme', rest_url( 'wp/v2/themes/' . $theme->get_stylesheet() ) );
     1273        }
     1274    }
     1275
     1276    /**
     1277     * Exposes the site logo through the WordPress REST API.
     1278     * This is used for fetching this information when user has no rights
     1279     * to update settings.
     1280     *
     1281     * @since 5.8.0
     1282     *
     1283     * @param WP_REST_Response $response REST API response.
     1284     */
     1285    protected function add_site_logo_to_index( WP_REST_Response $response ) {
     1286        $site_logo_id                = get_theme_mod( 'custom_logo' );
     1287        $response->data['site_logo'] = $site_logo_id;
     1288        if ( $site_logo_id ) {
     1289            $response->add_link(
     1290                'https://api.w.org/featuredmedia',
     1291                rest_url( 'wp/v2/media/' . $site_logo_id ),
     1292                array(
     1293                    'embeddable' => true,
     1294                )
     1295            );
    12721296        }
    12731297    }
Note: See TracChangeset for help on using the changeset viewer.