Make WordPress Core


Ignore:
Timestamp:
02/20/2024 11:14:50 AM (10 months ago)
Author:
youknowriad
Message:

Editor: Update Packages with the latest bug fixes for 6.5 beta 2.

It includes all the backports from this Gutenberg PR https://github.com/WordPress/gutenberg/pull/59197

Props youknowriad, get_dave.
See #60315.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/footnotes.php

    r57377 r57663  
    6969 */
    7070function register_block_core_footnotes() {
    71     $post_types = get_post_types(
     71    register_block_type_from_metadata(
     72        __DIR__ . '/footnotes',
    7273        array(
    73             'show_in_rest' => true,
    74             'public'       => true,
     74            'render_callback' => 'render_block_core_footnotes',
    7575        )
    7676    );
     77}
     78add_action( 'init', 'register_block_core_footnotes' );
     79
     80
     81/**
     82 * Registers the footnotes meta field required for footnotes to work.
     83 *
     84 * @since 6.5.0
     85 */
     86function register_block_core_footnotes_post_meta() {
     87    $post_types = get_post_types( array( 'show_in_rest' => true ) );
    7788    foreach ( $post_types as $post_type ) {
    7889        // Only register the meta field if the post type supports the editor, custom fields, and revisions.
    79         if ( post_type_supports( $post_type, 'editor' ) && post_type_supports( $post_type, 'custom-fields' ) && post_type_supports( $post_type, 'revisions' ) ) {
     90        if (
     91            post_type_supports( $post_type, 'editor' ) &&
     92            post_type_supports( $post_type, 'custom-fields' ) &&
     93            post_type_supports( $post_type, 'revisions' )
     94        ) {
    8095            register_post_meta(
    8196                $post_type,
     
    90105        }
    91106    }
    92     register_block_type_from_metadata(
    93         __DIR__ . '/footnotes',
    94         array(
    95             'render_callback' => 'render_block_core_footnotes',
    96         )
    97     );
    98107}
    99 add_action( 'init', 'register_block_core_footnotes' );
     108/**
     109 * Most post types are registered at priority 10, so use priority 20 here in
     110 * order to catch them.
     111*/
     112add_action( 'init', 'register_block_core_footnotes_post_meta', 20 );
    100113
    101114/**
Note: See TracChangeset for help on using the changeset viewer.