Automattic\WooCommerce\EmailEditor\Engine
Email_Editor::register_block_templates
Register block templates.
Method of the class: Email_Editor{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->register_block_templates(): void;
Email_Editor::register_block_templates() Email Editor::register block templates code WC 10.6.2
private function register_block_templates(): void {
// Since we cannot currently disable blocks in the editor for specific templates, disable templates when viewing site editor. @see https://github.com/WordPress/gutenberg/issues/41062.
$request_uri = '';
if ( isset( $_SERVER['REQUEST_URI'] ) && is_string( $_SERVER['REQUEST_URI'] ) ) {
$request_uri = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) );
}
if ( strstr( $request_uri, 'site-editor.php' ) === false ) {
$post_types = array_column( $this->get_post_types(), 'name' );
$this->templates->initialize( $post_types );
}
}