Automattic\WooCommerce\LayoutTemplates
LayoutTemplateRegistry::instantiate_layout_templates
Instantiate the matching layout templates and return them.
Method of the class: LayoutTemplateRegistry{}
No Hooks.
Returns
null. Nothing (null).
Usage
$LayoutTemplateRegistry = new LayoutTemplateRegistry(); $LayoutTemplateRegistry->instantiate_layout_templates( $query_params ): array;
- $query_params(array)
- Query params.
Default: array()
LayoutTemplateRegistry::instantiate_layout_templates() LayoutTemplateRegistry::instantiate layout templates code WC 10.4.3
public function instantiate_layout_templates( array $query_params = array() ): array {
// Make sure the block template logger is initialized before the templates are created,
// so that the logger will collect the template events.
$logger = BlockTemplateLogger::get_instance();
$layout_templates = array();
$layout_templates_info = $this->get_matching_layout_templates_info( $query_params );
foreach ( $layout_templates_info as $layout_template_info ) {
$layout_template = $this->get_layout_template_instance( $layout_template_info );
$layout_template_id = $layout_template->get_id();
$layout_templates[ $layout_template_id ] = $layout_template;
$logger->log_template_events_to_file( $layout_template_id );
}
return $layout_templates;
}