WooCommerce Code Reference

LayoutTemplateRegistry
in package

Layout template registry.

Table of Contents

$layout_template_instances  : array<string|int, mixed>
Layout template instances.
$layout_templates_info  : array<string|int, mixed>
Layout templates info.
$instance  : LayoutTemplateRegistry|null
Class instance.
get_instance()  : LayoutTemplateRegistry
Get the instance of the class.
instantiate_layout_templates()  : array<string|int, mixed>
Instantiate the matching layout templates and return them.
is_registered()  : bool
Check if a layout template is registered.
register()  : mixed
Register a single layout template.
unregister_all()  : mixed
Unregister all layout templates.
get_layout_template_instance()  : BlockTemplateInterface
Instantiate a single layout template and return it.
get_matching_layout_templates_info()  : array<string|int, mixed>
Get matching layout templates info.

Properties

Methods

instantiate_layout_templates()

Instantiate the matching layout templates and return them.

public instantiate_layout_templates([array<string|int, mixed> $query_params = array() ]) : array<string|int, mixed>
Parameters
$query_params : array<string|int, mixed> = array()

Query params.

Return values
array<string|int, mixed>

is_registered()

Check if a layout template is registered.

public is_registered(string $layout_template_id) : bool
Parameters
$layout_template_id : string

Layout template ID.

Return values
bool

register()

Register a single layout template.

public register(string $layout_template_id, string $layout_template_area, string $layout_template_class_name) : mixed
Parameters
$layout_template_id : string

Layout template ID.

$layout_template_area : string

Layout template area.

$layout_template_class_name : string

Layout template class to register.

Tags
throws
ValueError

If a layout template with the same ID already exists.

throws
ValueError

If the specified layout template area is empty.

throws
ValueError

If the specified layout template class does not exist.

throws
ValueError

If the specified layout template class does not implement the BlockTemplateInterface.

Return values
mixed

get_matching_layout_templates_info()

Get matching layout templates info.

private get_matching_layout_templates_info([array<string|int, mixed> $query_params = array() ]) : array<string|int, mixed>
Parameters
$query_params : array<string|int, mixed> = array()

Query params.

Return values
array<string|int, mixed>