Automattic\WooCommerce\EmailEditor\Engine\Templates
Templates_Registry::register
Register a template instance in the registry.
Method of the class: Templates_Registry{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Templates_Registry = new Templates_Registry(); $Templates_Registry->register( $template ): void;
- $template(Template) (required)
- The template to register.
Templates_Registry::register() Templates Registry::register code WC 10.6.2
public function register( Template $template ): void {
if ( ! \WP_Block_Templates_Registry::get_instance()->is_registered( $template->get_name() ) ) {
// skip registration if the template was already registered.
$result = register_block_template(
$template->get_name(),
array(
'title' => $template->get_title(),
'description' => $template->get_description(),
'content' => $template->get_content(),
'post_types' => $template->get_post_types(),
)
);
$this->templates[ $template->get_name() ] = $template;
}
}