Skip to content

Commit

Permalink
Add global variable for current block during render_acf_block
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasKau committed Oct 25, 2024
1 parent 2ba4cff commit 0525269
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Unreleased

* Add global variable for current block during `render_acf_block` (T-17629)

### 9.5.0rc: 2024-09-18

* Rewrite: allowed_block_types - Change logic for allowed blocks: 'none', 'all', 'all-core-blocks', 'all-acf-blocks', Fixes #226 (thanks @villekujansuu)
Expand Down
3 changes: 3 additions & 0 deletions inc/template-tags/acf-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ function render_acf_block( $block, $content = '', $is_preview = false, $post_id
$cache_key = "post_{$post_id}_{$block['id']}|{$content_hash}";
$cache_key = apply_filters( 'air_acf_block_cache_key', $cache_key, $block_slug, $post_id );

global $air_light_current_block;
$air_light_current_block = $block;

// Get block contents
if ( ! $block_cache_enabled ) {
$cache_bypass_reason = $is_preview || 'development' === wp_get_environment_type() ? 'preview/development' : 'cache setting';
Expand Down

0 comments on commit 0525269

Please sign in to comment.