BlockMetadata final class
Minn\Runtime\BlockMetadata · public/minn/src/Minn/Runtime/BlockMetadata.php · 95 lines
block.json to the settings a block type registers with: the property renames, the script and style handles (registered through the closures, one per entry), the view script modules, the block hooks positions, and the render template as a callback. Behaviour pinned by contracts/fixtures/api/blocks.json.
Constants and properties
| private | PROPERTIES = array ( 'apiVersion' => 'api_version', 'name' => 'name', 'title' => 'title', 'category' => 'category', 'parent' => 'parent', 'ancestor' => 'ancestor', 'icon' => 'icon', 'description' => 'description', 'keywords' => 'keywords', 'attributes' => 'attributes', 'providesContext' => 'provides_context', 'usesContext' => 'uses_context', 'selectors' => 'selectors', 'supports' => 'supports', 'styles' => 'styles', 'variations' => 'variations', 'example' => 'example', 'allowedBlocks' => 'allowed_blocks', ) | |
| private | SCRIPTS = array ( 'editorScript' => 'editor_script_handles', 'script' => 'script_handles', 'viewScript' => 'view_script_handles', ) | |
| private | STYLES = array ( 'editorStyle' => 'editor_style_handles', 'style' => 'style_handles', 'viewStyle' => 'view_style_handles', ) | |
| private | POSITIONS = array ( 'before' => 'before', 'after' => 'after', 'firstChild' => 'first_child', 'lastChild' => 'last_child', ) | |
| private | FIELD_HANDLES = array ( 'editorScript' => 'editor-script', 'editorStyle' => 'editor-style', 'script' => 'script', 'style' => 'style', 'viewScript' => 'view-script', 'viewScriptModule' => 'view-script-module', 'viewStyle' => 'view-style', ) |
Public
| static | settings(array $metadata, Closure $scriptHandle, Closure $styleHandle, Closure $moduleId, Closure $render): array# | Block settings from a block.json, the way the reference maps its properties.
@return array<string, mixed> | ||||||||||||
| static | assetHandle(string $block, string $field, int $index = 0): string# | The script or style handle a block.json field registers under; core blocks keep the `wp-block-` spelling. |
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | handles(array $metadata, string $field, Closure $register): ?array# | The registered handles for one asset field: every entry when the field lists several; null when the field is absent. @return list<string>|null @return list<string>|null |
Nothing matches.