equal
deleted
inserted
replaced
211 $this->inner_blocks[ $index++ ]->render(); |
211 $this->inner_blocks[ $index++ ]->render(); |
212 } |
212 } |
213 } |
213 } |
214 |
214 |
215 if ( $is_dynamic ) { |
215 if ( $is_dynamic ) { |
216 $global_post = $post; |
216 $global_post = $post; |
|
217 $parent = WP_Block_Supports::$block_to_render; |
|
218 |
|
219 WP_Block_Supports::$block_to_render = $this->parsed_block; |
|
220 |
217 $block_content = (string) call_user_func( $this->block_type->render_callback, $this->attributes, $block_content, $this ); |
221 $block_content = (string) call_user_func( $this->block_type->render_callback, $this->attributes, $block_content, $this ); |
218 $post = $global_post; |
222 |
|
223 WP_Block_Supports::$block_to_render = $parent; |
|
224 |
|
225 $post = $global_post; |
219 } |
226 } |
220 |
227 |
221 if ( ! empty( $this->block_type->script ) ) { |
228 if ( ! empty( $this->block_type->script ) ) { |
222 wp_enqueue_script( $this->block_type->script ); |
229 wp_enqueue_script( $this->block_type->script ); |
223 } |
230 } |
232 * @since 5.0.0 |
239 * @since 5.0.0 |
233 * |
240 * |
234 * @param string $block_content The block content about to be appended. |
241 * @param string $block_content The block content about to be appended. |
235 * @param array $block The full block, including name and attributes. |
242 * @param array $block The full block, including name and attributes. |
236 */ |
243 */ |
237 return apply_filters( 'render_block', $block_content, $this->parsed_block ); |
244 $block_content = apply_filters( 'render_block', $block_content, $this->parsed_block ); |
|
245 |
|
246 /** |
|
247 * Filters the content of a single block. |
|
248 * |
|
249 * The dynamic portion of the hook name, `$name`, refers to |
|
250 * the block name, e.g. "core/paragraph". |
|
251 * |
|
252 * @since 5.7.0 |
|
253 * |
|
254 * @param string $block_content The block content about to be appended. |
|
255 * @param array $block The full block, including name and attributes. |
|
256 */ |
|
257 $block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block ); |
|
258 |
|
259 return $block_content; |
238 } |
260 } |
239 |
261 |
240 } |
262 } |