Skip to content

Commit

Permalink
[MOOSE-81]: update ACF block render template function
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffDusome committed Mar 5, 2024
1 parent e2f8afa commit bcdc08f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions wp-content/plugins/core/src/Blocks/Block_Registrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ public function register( string $block_name, string $blocks_dir = self::BLOCKS_
}

/**
* @param array $args
* @param array $block The block attributes.
* @param string $content The block content.
* @param bool $is_preview Whether the block is being rendered for editing preview.
* @param int $post_id The current post being edited or viewed.
* @param \WP_Block|null $wp_block The block instance (since WP 5.5).
*/
public function render_template( array $args ): void {
$template = $args['render_template'];
$path = str_replace( 'dist/blocks/', 'blocks/', $args['path'] );
public function render_template( array $block, string $content = '', bool $is_preview = false, int $post_id = 0, ?\WP_Block $wp_block = null ): void {
$template = $block['render_template'];
$path = str_replace( 'dist/blocks/', 'blocks/', $block['path'] );

if ( ! file_exists( "$path/$template" ) ) {
return;
Expand Down

0 comments on commit bcdc08f

Please sign in to comment.