Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,7 @@

// Register class methods with the WordPress hooks which will call them.
add_action( 'init', array( 'Mitlib\PostTypes\HeroImage', 'define' ) );
add_action( 'init', array( 'Mitlib\PostTypes\HeroImage', 'register_blocks' ) );
add_action( 'rest_api_init', array( 'Mitlib\PostTypes\HeroImage', 'api_enable' ) );
add_filter( 'acf/settings/load_json', array( 'Mitlib\PostTypes\HeroImage', 'load_point' ) );
add_filter( 'acf/settings/save_json', array( 'Mitlib\PostTypes\HeroImage', 'save_point' ) );

/**
* Registers the block(s) metadata from the `blocks-manifest.php` and registers the block type(s)
* based on the registered block metadata. Behind the scenes, it registers also all assets so they can be enqueued
* through the block editor in the corresponding context.
*
* @see https://make.wordpress.org/core/2025/03/13/more-efficient-block-type-registration-in-6-8/
* @see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/
*/
function register_blocks() {
wp_register_block_types_from_metadata_collection(
__DIR__ . '/build',
__DIR__ . '/build/blocks-manifest.php'
);
}
add_action( 'init', 'Mitlib\PostTypes\register_blocks' );
15 changes: 15 additions & 0 deletions web/app/plugins/mitlib-post-hero-images/src/class-heroimage.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,19 @@ public static function define() {

register_post_type( 'hero_images', $args );
}

/**
* Registers the block(s) metadata from the `blocks-manifest.php` and registers the block type(s)
* based on the registered block metadata. Behind the scenes, it registers also all assets so they can be enqueued
* through the block editor in the corresponding context.
*
* @see https://make.wordpress.org/core/2025/03/13/more-efficient-block-type-registration-in-6-8/
* @see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/
*/
public static function register_blocks() {
wp_register_block_types_from_metadata_collection(
plugin_dir_path( __DIR__ ) . 'build',
plugin_dir_path( __DIR__ ) . 'build/blocks-manifest.php'
);
}
}
Loading