Download the PHP package kaiseki/wp-block-content-filter without Composer
On this page you can find all versions of the php package kaiseki/wp-block-content-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kaiseki/wp-block-content-filter
More information about kaiseki/wp-block-content-filter
Files in kaiseki/wp-block-content-filter
Package wp-block-content-filter
Short Description Filter and transform WordPress block render output through a configurable pipeline of per-block filters.
License MIT
Homepage https://github.com/kaisekidev/kaiseki-wp-block-content-filter
Informations about the package wp-block-content-filter
kaiseki/wp-block-content-filter
Filter and transform WordPress block render output through a configurable pipeline of per-block filters.
BlockContentFilterRegistry hooks into the render_block filter and, for each rendered block, runs
the filters whose block-name pattern matches the block's blockName (matched with fnmatch, so
core/* matches every core block). Each filter implements BlockContentFilterInterface and receives
the rendered HTML plus the block's data, returning the (possibly transformed) HTML.
The package ships a few ready-made filters:
CoreParagraphClassFilter/CoreHeadingClassFilter/CoreListClassFilter— add a CSS class to the outermost element of the rendered block.CoreHtmlWrapFilter— wrap the rendered block in a<div class="…">.DisableFullscreenMode— a standalone hook provider that turns off the block editor's fullscreen mode.
Installation
Requires PHP 8.2 or newer.
Usage
Register ConfigProvider with your laminas-style config aggregator, then declare a
block_content_filter map of fnmatch block-name patterns to a list of filter class-strings (or
instances). ConfigProvider already wires BlockContentFilterRegistry into hook.provider, so the
registry runs automatically once ConfigProvider is registered — you only need to supply the filter
map (do not add BlockContentFilterRegistry to hook.provider yourself, or it will be registered
twice and the pipeline will run twice):
Each filter class-string is resolved through the container (Config::initClassMap), so a filter that
needs constructor arguments can be registered as a container service; the bundled filters work out of
the box with sensible defaults.
The standalone DisableFullscreenMode provider is not registered by ConfigProvider — opt into it
explicitly by adding it to your own hook.provider list:
Write your own filter by implementing BlockContentFilterInterface:
Development
License
MIT — see LICENSE.
All versions of wp-block-content-filter with dependencies
kaiseki/config Version ^2.0
kaiseki/wp-hook Version ^2.0
masterminds/html5 Version ^2.10
psr/container Version ^1.1 || ^2.0