You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Public API for the fields and assets of a registered block #115
We use a small tool that checks block markup before it is saved (for AI-assisted content editing): it validates attrs.blockstudio.attributes against the fields of each Blockstudio block and previews a block together with the CSS and JS it adds. To do that it currently relies on internals that are not documented and could change in any release:
Field definitions: the blockstudio property Blockstudio sets on the registered WP_Block_Type ($type->blockstudio['attributes']), plus the blockstudio attribute to tell Blockstudio blocks apart.
Block assets:Blockstudio\Build::data() to find the assets of a block, Assets::get_id() for the handle, Assets::get_path() and Files::get_relative_url() for the URL. Block CSS and JS are added through the output buffer rather than wp_enqueue_*, so they cannot be read from wp_styles() / wp_scripts().
Would you consider a small public, documented API for this, next to the existing bs_* helpers? For example:
// Field definitions of a registered Blockstudio block, null for other blocks.bs_block_fields( string $name ): ?array;
// The assets a block adds: type (style/script/module), handle, URL or inline, scope (editor/frontend).bs_block_assets( string $name ): array;
Names and shape are only a suggestion. If you like the idea I can open a PR with the functions, docs and tests, or adapt it to whatever fits Blockstudio's design better.
Released in Blockstudio 7.7.2. The documented public helpers are bs_block_fields() and bs_block_assets(), implemented in 6902dfd6. The release also includes bs_block_extension_fields() from #121 for fields added by matching extensions, including on core and third-party blocks.
Activity
Merge reviewed contributions and add public block metadata APIs [all]
dnnsjsk commentedon Oct 15, 2026
Released in Blockstudio 7.7.2. The documented public helpers are
bs_block_fields()andbs_block_assets(), implemented in 6902dfd6. The release also includesbs_block_extension_fields()from #121 for fields added by matching extensions, including on core and third-party blocks.