Skip to content

Commit ad347be

Browse files
authored
🔧 Add a configurable $apiVersion property to blocks (#321)
1 parent 5fe0cee commit ad347be

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Block.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ abstract class Block extends Composer implements BlockContract
277277
*/
278278
public $blockVersion = 2;
279279

280+
/**
281+
* The ACF block API version.
282+
*
283+
* @var int
284+
*/
285+
public $apiVersion = 2;
286+
280287
/**
281288
* Validate block fields as per the field group configuration.
282289
*
@@ -632,7 +639,7 @@ public function settings(): Collection
632639
'supports' => $this->getSupports(),
633640
'textdomain' => $this->getTextDomain(),
634641
'acf_block_version' => $this->blockVersion,
635-
'api_version' => 2,
642+
'api_version' => $this->apiVersion,
636643
'validate' => $this->validate,
637644
'use_post_meta' => $this->usePostMeta,
638645
'render_callback' => function (

0 commit comments

Comments
 (0)