kaiseki/wp-block-editor
Composer 安装命令:
composer require kaiseki/wp-block-editor
包简介
WordPress block editor (Gutenberg) helpers: block categories, editor and block-type toggles, embed variations
README 文档
README
WordPress block editor (Gutenberg) helpers: block categories, editor and block-type toggles, embed variations.
A set of small hook providers that configure the block editor from a single block_editor config key.
Each feature is a kaiseki/wp-hook HookProviderInterface wired through ConfigProvider, so you
enable it by adding its config and registering the provider — no manual add_filter plumbing.
Installation
composer require kaiseki/wp-block-editor
Requires PHP 8.2 or newer.
Usage
Register ConfigProvider with your laminas-style config aggregator, then drive the features from the
block_editor config key:
use Kaiseki\WordPress\BlockEditor\DisableBlockEditor\DisableBlockEditor; use Kaiseki\WordPress\BlockEditor\EnterTitleHere\EnterTitleHereFilter; return [ 'block_editor' => [ // Register custom block categories (classes implementing BlockCategoryInterface). 'add_categories_at_top' => false, 'categories' => [ MyBlockCategory::class, ], // Fall back to the classic editor for specific post types or via callables. 'disable_block_editor' => [ 'post_types' => ['product'], 'post_filter' => [], ], // Enable/disable individual core embed block variations. 'embed_variations' => [ 'disable' => ['tiktok'], 'enable' => [], ], // Override the "Enter title here" placeholder per post type. 'enter_title_here' => [ 'page' => 'Enter page name', ], ], // Activate the providers you use via kaiseki/wp-hook. 'hook' => [ 'provider' => [ DisableBlockEditor::class, EnterTitleHereFilter::class, ], ], ];
ConfigProvider registers factories for every feature (BlockCategoriesRegistry, UnregisterBlockTypes,
DisableBlockEditor, DisableEmbedVariations, EnableEmbedVariations, EnterTitleHereFilter), each
reading its slice of the block_editor config from the container.
Custom block categories
Implement BlockCategoryInterface and add the class to block_editor.categories:
use Kaiseki\WordPress\BlockEditor\BlockCategories\BlockCategoryInterface; final class MyBlockCategory implements BlockCategoryInterface { public function getSlug(): string { return 'my-blocks'; } public function getTitle(): string { return 'My Blocks'; } public function getIcon(): ?string { return null; } public function beforeSlug(): string { return ''; } public function afterSlug(): string { return ''; } }
Development
composer install
composer check # check-deps, cs-check, phpstan
License
MIT — see LICENSE.
kaiseki/wp-block-editor 适用场景与选型建议
kaiseki/wp-block-editor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 711 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 02 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kaiseki/wp-block-editor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kaiseki/wp-block-editor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 711
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-10