From db373e402c92d5133606704a1b35c675d6cafd11 Mon Sep 17 00:00:00 2001 From: stoykodev Date: Sun, 24 Aug 2025 12:56:55 +0300 Subject: [PATCH] Add support allowedBlocks --- src/Block.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Block.php b/src/Block.php index c82f58b..ece0860 100644 --- a/src/Block.php +++ b/src/Block.php @@ -263,6 +263,13 @@ abstract class Block extends Composer implements BlockContract */ public $template = []; + /** + * The allowed inner blocks. + * + * @var array + */ + public $allowed_blocks = []; + /** * Determine whether to save the block's data as post meta. * @@ -412,6 +419,14 @@ public function getSupports(): array return $supports->all(); } + /** + * Retrieve the allowed inner blocks. + */ + public function getAllowedBlocks(): array + { + return $this->allowed_blocks; + } + /** * Retrieve the block support attributes. */ @@ -668,6 +683,7 @@ public function settings(): Collection 'api_version' => $this->getApiVersion(), 'validate' => $this->validate, 'use_post_meta' => $this->usePostMeta, + 'allowed_blocks' => $this->getAllowedBlocks(), 'render_callback' => function ( $block, $content = '', @@ -739,6 +755,7 @@ public function toJson(): string 'render_callback', 'use_post_meta', 'validate', + 'allowed_blocks', ]); return $settings->filter()->toJson(JSON_PRETTY_PRINT);