WordPress.org

Make WordPress Core

Ticket #46187: 46187-1.diff

File 46187-1.diff, 1.5 KB (added by manzoorwani.jk, 2 years ago)
  • src/wp-includes/blocks.php

     
    200200         */
    201201        $block = apply_filters( 'render_block_data', $block, $source_block );
    202202
    203         $block_type    = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
    204         $is_dynamic    = $block['blockName'] && null !== $block_type && $block_type->is_dynamic();
     203        $block_name = $block['blockName'];
     204
     205        $block_type    = WP_Block_Type_Registry::get_instance()->get_registered( $block_name );
     206        $is_dynamic    = $block_name && null !== $block_type && $block_type->is_dynamic();
    205207        $block_content = '';
    206208        $index         = 0;
    207209
     
    227229         * @param string $block_content The block content about to be appended.
    228230         * @param array  $block         The full block, including name and attributes.
    229231         */
    230         return apply_filters( 'render_block', $block_content, $block );
     232        $block_content = apply_filters( 'render_block', $block_content, $block );
     233
     234        /**
     235         * Filters the content of a single block.
     236         *
     237         * The dynamic portion of the hook name, `$block_name`, refers to
     238         * the block name - "namespace/block".
     239         *
     240         * @since x.y.z
     241         *
     242         * @param string $block_content The block content about to be appended.
     243         * @param array  $block         The full block, including name and attributes.
     244         */
     245        return apply_filters( "render_block_{$block_name}", $block_content, $block );
    231246}
    232247
    233248/**