WordPress.org

Make WordPress Core

Ticket #48104: 48104.diff

File 48104.diff, 1.5 KB (added by andraganescu, 7 weeks ago)
  • src/wp-includes/blocks.php

    diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php
    index e8647bf526..e22c72d220 100644
    a b function render_block( $block ) { 
    260260
    261261        if ( $is_dynamic ) {
    262262                $global_post   = $post;
    263                 $block_content = $block_type->render( $block['attrs'], $block_content );
     263                $block_content = $block_type->render( $block['attrs'], $block_content, $block );
    264264                $post          = $global_post;
    265265        }
    266266
  • src/wp-includes/class-wp-block-type.php

    diff --git a/src/wp-includes/class-wp-block-type.php b/src/wp-includes/class-wp-block-type.php
    index 6ffda95b4e..bdd5ff476c 100644
    a b public function __construct( $block_type, $args = array() ) { 
    9797         *
    9898         * @param array  $attributes Optional. Block attributes. Default empty array.
    9999         * @param string $content    Optional. Block content. Default empty string.
     100         * @param string $block      Optional. The block object. Default null.
    100101         * @return string Rendered block type output.
    101102         */
    102         public function render( $attributes = array(), $content = '' ) {
     103        public function render( $attributes = array(), $content = '', $block = null ) {
    103104                if ( ! $this->is_dynamic() ) {
    104105                        return '';
    105106                }
    106107
    107108                $attributes = $this->prepare_attributes_for_render( $attributes );
    108109
    109                 return (string) call_user_func( $this->render_callback, $attributes, $content );
     110                return (string) call_user_func( $this->render_callback, $attributes, $content, $block );
    110111        }
    111112
    112113        /**