WC_REST_Layout_Templates_Controller::get_layout_templates()privateWC 1.0

Get layout templates.

Method of the class: WC_REST_Layout_Templates_Controller{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->get_layout_templates( $query_params ): array;
$query_params(array) (required)
Query params.

WC_REST_Layout_Templates_Controller::get_layout_templates() code WC 8.9.0

private function get_layout_templates( array $query_params ): array {
	$layout_template_registry = wc_get_container()->get( LayoutTemplateRegistry::class );

	return array_map(
		function( $layout_template ) {
			return $layout_template->to_json();
		},
		$layout_template_registry->instantiate_layout_templates( $query_params )
	);
}