default content block that uses core inner blocks

This commit is contained in:
2025-11-23 17:34:49 +00:00
parent de94d0e68e
commit 00d0861014
27 changed files with 698 additions and 732 deletions

View File

@@ -1,14 +1,30 @@
<?php
namespace App\Admin;
use Blocks\Content;
class Blocks
{
public function __construct()
{
add_filter( 'block_categories_all' , [$this, 'categories']);
add_action('allowed_block_types_all', [$this, 'blacklist'], 100, 2);
}
public function categories( $categories )
{
// Adding a new category.
$categories = array_merge([
[
'slug' => 'badegg',
'title' => __('Provided by Bad Egg Digital'),
],
], $categories);
return $categories;
}
public function blacklist()
{
// Reference:
@@ -130,6 +146,10 @@ class Blocks
'core/social-links',
];
$Content = new Content\Content();
$blacklist = array_diff($blacklist, $Content->inner_blocks());
return array_values( array_diff( $blocks, $blacklist ) );
}
}