Automattic\WooCommerce\EmailEditor\Engine\Templates

Templates_Registry::registerpublicWC 1.0

Register a template instance in the registry.

Метод класса: Templates_Registry{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Templates_Registry = new Templates_Registry();
$Templates_Registry->register( $template ): void;
$template(Template) (обязательный)
The template to register.

Код Templates_Registry::register() WC 9.9.5

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.
		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;
	}
}