Make WordPress Core


Ignore:
Timestamp:
02/07/2024 09:18:38 AM (3 years ago)
Author:
youknowriad
Message:

REST API: Introduce the necessary endpoints for the font library.

This commits add three endpoints to retrieve and manipulate fonts in WordPress.
This commit also means that we now have a fully functional Font Library in the site editor.

Props get_dave, youknowriad, mmaattiiaass, grantmkin, swissspidy, mcsf, jorbin, ocean90.
See #59166.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/fonts/class-wp-font-library.php

    r57539 r57548  
    116116         *
    117117         * @param string $slug Font collection slug.
    118          * @return WP_Font_Collection|WP_Error Font collection object,
    119          *                                     or WP_Error object if the font collection doesn't exist.
     118         * @return WP_Font_Collection|null Font collection object, or null if the font collection doesn't exist.
    120119         */
    121120        public function get_font_collection( $slug ) {
    … …  
    123122                        return $this->collections[ $slug ];
    124123                }
    125                 return new WP_Error( 'font_collection_not_found', __( 'Font collection not found.' ) );
     124                return null;
    126125        }
    127126
Note: See TracChangeset for help on using the changeset viewer.