Automattic\WooCommerce\Blocks
BlockTemplatesRegistry::get_template()
Returns the template matching the slug
Method of the class: BlockTemplatesRegistry{}
No Hooks.
Return
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 9.2.3
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; }