Skip to content

Commit

Permalink
🎨 Finalize implementation from #313
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Jan 18, 2025
1 parent 63c25c6 commit bbf5642
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 8 additions & 4 deletions src/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,17 +419,21 @@ 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() ?? [];
}

/**
* Retrieve the inline block styles.
*/
public function getInlineStyle(): string
{
$supports = $this->getSupportHtmlAttributes();
$supports = $this->getHtmlAttributes();

return $supports['style'] ?? '';
}
Expand All @@ -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),
Expand Down

0 comments on commit bbf5642

Please sign in to comment.