Skip to content

Commit

Permalink
Add support for removing a block(s) by key (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxwilko committed Apr 12, 2024
1 parent 06f479c commit 3946f8f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions classes/BlockManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,20 @@ public function isBlock(string $type): bool
{
return !!$this->getConfig($type);
}

/**
* Remove a block by key
*/
public function removeBlock(string|array $key): void
{
if (is_array($key)) {
foreach ($key as $k) {
$this->removeBlock($k);
}

return;
}

unset($this->blocks[$key]);
}
}

0 comments on commit 3946f8f

Please sign in to comment.