Skip to content

Commit 0525269

Browse files
committed
Add global variable for current block during render_acf_block
1 parent 2ba4cff commit 0525269

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Unreleased
2+
3+
* Add global variable for current block during `render_acf_block` (T-17629)
4+
15
### 9.5.0rc: 2024-09-18
26

37
* Rewrite: allowed_block_types - Change logic for allowed blocks: 'none', 'all', 'all-core-blocks', 'all-acf-blocks', Fixes #226 (thanks @villekujansuu)

inc/template-tags/acf-blocks.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ function render_acf_block( $block, $content = '', $is_preview = false, $post_id
3232
$cache_key = "post_{$post_id}_{$block['id']}|{$content_hash}";
3333
$cache_key = apply_filters( 'air_acf_block_cache_key', $cache_key, $block_slug, $post_id );
3434

35+
global $air_light_current_block;
36+
$air_light_current_block = $block;
37+
3538
// Get block contents
3639
if ( ! $block_cache_enabled ) {
3740
$cache_bypass_reason = $is_preview || 'development' === wp_get_environment_type() ? 'preview/development' : 'cache setting';

0 commit comments

Comments
 (0)