From 20cc13b4f839b94a8c429f5b6ff00bb344ec82b9 Mon Sep 17 00:00:00 2001 From: Michael Metdepenningen Date: Mon, 13 Nov 2023 18:17:29 +0100 Subject: [PATCH] support blocks with no fields -> more robust --- src/FilamentPageBuilderServiceProvider.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/FilamentPageBuilderServiceProvider.php b/src/FilamentPageBuilderServiceProvider.php index 472ccb7..0b8d38e 100644 --- a/src/FilamentPageBuilderServiceProvider.php +++ b/src/FilamentPageBuilderServiceProvider.php @@ -33,10 +33,9 @@ public function packageBooted(): void // support 'empty' form blocks Block::creating(function (Block $model) { - if ($model->content == null) { - $model->content = []; + if(!array_key_exists('content', $model->getAttributes()) || $model->getAttributes()['content'] == null) { + $model->setAttribute('content', []); } - return $model; }); }