BlockFilters final class
Minn\Runtime\BlockFilters · public/minn/src/Minn/Runtime/BlockFilters.php · 127 lines
The block-level filters plugin code hooks (pre_render_block, render_block_data, render_block, render_block_{name}), applied around the engine's own renderer so a plugin sees every block the page renders, not only the ones it registered.
Constants and properties
| const | NATIVE_DATA_DONE = array ( 'wp_render_elements_support_styles' => 10, 'wp_render_block_style_variation_support_styles' => 10, 'block_core_gallery_data_id_backcompatibility' => 10, ) | The data filters the engine's renderer does itself for a block it renders natively: element styles, style variations, a gallery's image ids. |
| const | NATIVE_RENDER_DONE = array ( 'wp_render_elements_class_name' => 10, 'wp_render_block_style_variation_class_name' => 10, 'wp_render_layout_support_flag' => array ( 0 => 10, 1 => '_minn_render_child_layout_support', ), 'block_core_paragraph_add_class' => 10, ) | The render filters it does itself: the element and style variation classes, the layout's container classes (a child's own layout left to a stand-in), the paragraph's class. |
| private | static array $parsedFor |
Public
| static | active(): bool# | Whether any block filter is registered. | |||||||||
| static | toArray(Minn\Blocks\Block $block): array# | A block as the parsed array plugins receive. @return array<string, mixed> the parsed-array shape plugin code reads | |||||||||
| static | fromArray(array $parsed): Minn\Blocks\Block# | A block from the parsed array plugins hand back. | |||||||||
| static | data(array $parsed, ?object $parent, array $done = array ( )): mixed# | A parsed block through render_block_data, without the callbacks done already (NATIVE_DATA_DONE for a block the engine's renderer renders).
| |||||||||
| static | rendered(string $html, array $parsed, ?object $instance, array $done = array ( )): string# | A rendered block through render_block and its per-name filter, without the callbacks done already (NATIVE_RENDER_DONE, with its stand-ins, for a block the engine's renderer renders).
| |||||||||
| static | before(Minn\Blocks\Block $block, array $done = array ( )): Minn\Blocks\Block|string# | A short-circuit from pre_render_block, or the block as render_block_data left it.
| |||||||||
| static | after(Minn\Blocks\Block $block, string $html, array $done = array ( )): string# | A rendered block through render_block and its per-name filter.
|
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | context(): array# | @return array<string, mixed> |
Nothing matches.