Skip to content

Commit

Permalink
🐛 Only set parent and ancestor when not empty (Fixes #293) (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored Dec 19, 2024
1 parent ff65e77 commit 9b3ba57
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,6 @@ public function settings(): Collection
'category' => $this->category,
'icon' => $this->getIcon(),
'keywords' => $this->keywords,
'parent' => $this->parent,
'ancestor' => $this->ancestor,
'post_types' => $this->post_types,
'mode' => $this->mode,
'align' => $this->align,
Expand All @@ -554,6 +552,14 @@ public function settings(): Collection
},
]);

if (filled($this->parent)) {
$settings = $settings->put('parent', $this->parent);
}

if (filled($this->ancestor)) {
$settings = $settings->put('ancestor', $this->ancestor);
}

if ($this->example !== false) {
if (method_exists($this, 'example') && is_array($example = $this->example())) {
$this->example = array_merge($this->example, $example);
Expand Down

0 comments on commit 9b3ba57

Please sign in to comment.