Automattic\WooCommerce\Blocks
BlockTemplatesRegistry::get_template
Returns the template matching the slug
Method of the class: BlockTemplatesRegistry{}
No Hooks.
Returns
AbstractTemplate|AbstractTemplatePart|null.
Usage
$BlockTemplatesRegistry = new BlockTemplatesRegistry(); $BlockTemplatesRegistry->get_template( $template_slug );
- $template_slug(string) (required)
- Slug of the template to retrieve.
BlockTemplatesRegistry::get_template() BlockTemplatesRegistry::get template code WC 10.8.1
public function get_template( $template_slug ) {
if ( array_key_exists( $template_slug, $this->templates ) ) {
$registered_template = $this->templates[ $template_slug ];
return $registered_template;
}
return null;
}