Make WordPress Core


Ignore:
Timestamp:
02/02/2021 05:14:46 AM (4 years ago)
Author:
noisysocks
Message:

Editor: Update @wordpress npm packages

Update @wordpress npm packages to the latest published versions. This means that
the block editor includes functionality that exists in Gutenberg 9.9.

Fixes #52334.

File:
1 edited

Legend:

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

    r48177 r50137  
    1414 */
    1515function render_block_core_block( $attributes ) {
     16    static $seen_refs = array();
     17
    1618    if ( empty( $attributes['ref'] ) ) {
    1719        return '';
     
    2325    }
    2426
     27    if ( isset( $seen_refs[ $attributes['ref'] ] ) ) {
     28        if ( ! is_admin() ) {
     29            trigger_error(
     30                sprintf(
     31                    // translators: %s is the user-provided title of the reusable block.
     32                    __( 'Could not render Reusable Block <strong>%s</strong>: blocks cannot be rendered inside themselves.' ),
     33                    $reusable_block->post_title
     34                ),
     35                E_USER_WARNING
     36            );
     37        }
     38
     39        // WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
     40        // is set in `wp_debug_mode()`.
     41        $is_debug = defined( 'WP_DEBUG' ) && WP_DEBUG &&
     42            defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY;
     43
     44        return $is_debug ?
     45            // translators: Visible only in the front end, this warning takes the place of a faulty block.
     46            __( '[block rendering halted]' ) :
     47            '';
     48    }
     49
    2550    if ( 'publish' !== $reusable_block->post_status || ! empty( $reusable_block->post_password ) ) {
    2651        return '';
    2752    }
    2853
    29     return do_blocks( $reusable_block->post_content );
     54    $seen_refs[ $attributes['ref'] ] = true;
     55
     56    $result = do_blocks( $reusable_block->post_content );
     57    unset( $seen_refs[ $attributes['ref'] ] );
     58    return $result;
    3059}
    3160
Note: See TracChangeset for help on using the changeset viewer.