From bbf5642a407070518b7652f0924343d467f20f19 Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 18 Jan 2025 03:12:34 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Finalize=20implementation=20from?= =?UTF-8?q?=20#313?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 +-- src/Block.php | 12 ++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 5f96686..e1290a6 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,7 @@ "require": { "php": "^8.0", "stoutlogic/acf-builder": "^1.11", - "laravel/prompts": "*", - "spatie/once": "*" + "laravel/prompts": "*" }, "require-dev": { "laravel/pint": "^1.14", diff --git a/src/Block.php b/src/Block.php index d81b2b7..c7ae01b 100644 --- a/src/Block.php +++ b/src/Block.php @@ -419,9 +419,13 @@ public function getSupportAttributes(): array /** * Retrieve the block HTML attributes. */ - public function getSupportHtmlAttributes(): array + public function getHtmlAttributes(): array { - return once(fn () => $this->preview ? [] : (WP_Block_Supports::get_instance()?->apply_block_supports() ?? [])); + if ($this->preview) { + return []; + } + + return WP_Block_Supports::get_instance()?->apply_block_supports() ?? []; } /** @@ -429,7 +433,7 @@ public function getSupportHtmlAttributes(): array */ public function getInlineStyle(): string { - $supports = $this->getSupportHtmlAttributes(); + $supports = $this->getHtmlAttributes(); return $supports['style'] ?? ''; } @@ -439,7 +443,7 @@ public function getInlineStyle(): string */ public function getClasses(): string { - $supports = $this->getSupportHtmlAttributes(); + $supports = $this->getHtmlAttributes(); return str_replace( acf_slugify($this->namespace),