Make WordPress Core


Ignore:
Timestamp:
02/07/2024 09:18:38 AM (14 months 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/post.php

    r57541 r57548  
    568568        'wp_font_family',
    569569        array(
    570             'labels'       => array(
     570            'labels'                         => array(
    571571                'name'          => __( 'Font Families' ),
    572572                'singular_name' => __( 'Font Family' ),
    573573            ),
    574             'public'       => false,
    575             '_builtin'     => true, /* internal use only. don't use this when registering your own post type. */
    576             'hierarchical' => false,
    577             'capabilities' => array(
     574            'public'                         => false,
     575            '_builtin'                       => true, /* internal use only. don't use this when registering your own post type. */
     576            'hierarchical'                   => false,
     577            'capabilities'                   => array(
    578578                'read'                   => 'edit_theme_options',
    579579                'read_private_posts'     => 'edit_theme_options',
     
    587587                'delete_published_posts' => 'edit_theme_options',
    588588            ),
    589             'map_meta_cap' => true,
    590             'query_var'    => false,
    591             'show_in_rest' => false,
    592             'rewrite'      => false,
     589            'map_meta_cap'                   => true,
     590            'query_var'                      => false,
     591            'rewrite'                        => false,
     592            'show_in_rest'                   => true,
     593            'rest_base'                      => 'font-families',
     594            'rest_controller_class'          => 'WP_REST_Font_Families_Controller',
     595            // Disable autosave endpoints for font families.
     596            'autosave_rest_controller_class' => 'stdClass',
    593597        )
    594598    );
     
    597601        'wp_font_face',
    598602        array(
    599             'labels'       => array(
     603            'labels'                         => array(
    600604                'name'          => __( 'Font Faces' ),
    601605                'singular_name' => __( 'Font Face' ),
    602606            ),
    603             'public'       => false,
    604             '_builtin'     => true, /* internal use only. don't use this when registering your own post type. */
    605             'hierarchical' => false,
    606             'capabilities' => array(
     607            'public'                         => false,
     608            '_builtin'                       => true, /* internal use only. don't use this when registering your own post type. */
     609            'hierarchical'                   => false,
     610            'capabilities'                   => array(
    607611                'read'                   => 'edit_theme_options',
    608612                'read_private_posts'     => 'edit_theme_options',
     
    616620                'delete_published_posts' => 'edit_theme_options',
    617621            ),
    618             'map_meta_cap' => true,
    619             'query_var'    => false,
    620             'show_in_rest' => false,
    621             'rewrite'      => false,
     622            'map_meta_cap'                   => true,
     623            'query_var'                      => false,
     624            'rewrite'                        => false,
     625            'show_in_rest'                   => true,
     626            'rest_base'                      => 'font-families/(?P<font_family_id>[\d]+)/font-faces',
     627            'rest_controller_class'          => 'WP_REST_Font_Faces_Controller',
     628            // Disable autosave endpoints for font faces.
     629            'autosave_rest_controller_class' => 'stdClass',
    622630        )
    623631    );
Note: See TracChangeset for help on using the changeset viewer.