Wire up the Filtered Image block end-to-end

This commit is contained in:
Keith Solomon
2026-08-05 16:48:03 -05:00
parent c2a0ae2d8c
commit d21d3c9ac2
5 changed files with 285 additions and 3 deletions
+26 -3
View File
@@ -26,16 +26,39 @@ define( 'IMAGE_FILTERS_URL', plugin_dir_url( __FILE__ ) );
/**
* Bootstrap the plugin.
*
* Block registration is wired in a follow-up task. This function exists so the
* activation hook can be added without needing a global-side-effect pattern.
* Registers the Filtered Image block from the build directory. The registered
* block type is static (its markup is produced by the JS save function).
*
* @return void
*/
function image_filters_bootstrap(): void {
// Block registration will be added in Task 5.
if ( ! function_exists( 'register_block_type' ) ) {
return;
}
register_block_type(
IMAGE_FILTERS_DIR . 'build',
array(
'render_callback' => 'image_filters_render_block',
)
);
}
add_action( 'plugins_loaded', 'image_filters_bootstrap' );
/**
* Render callback for the Filtered Image block.
*
* Static blocks render their own markup via save.js. The render_callback
* is a placeholder for future server-side logic (e.g. dynamic alt text).
*
* @param array $attributes Block attributes.
* @param string $content Saved block content.
* @return string
*/
function image_filters_render_block( array $attributes, string $content = '' ): string {
return $content;
}
/**
* Load plugin textdomain for translations.
*