Automattic\WooCommerce\LayoutTemplates

LayoutTemplateRegistry::get_matching_layout_templates_info()privateWC 1.0

Get matching layout templates info.

Method of the class: LayoutTemplateRegistry{}

No Hooks.

Return

null. Nothing (null).

Usage

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

LayoutTemplateRegistry::get_matching_layout_templates_info() code WC 9.4.2

private function get_matching_layout_templates_info( array $query_params = array() ): array {
	$area_to_match = isset( $query_params['area'] ) ? $query_params['area'] : null;
	$id_to_match   = isset( $query_params['id'] ) ? $query_params['id'] : null;

	$matching_layout_templates_info = array();

	foreach ( $this->layout_templates_info as $layout_template_info ) {
		if ( ! empty( $area_to_match ) && $layout_template_info['area'] !== $area_to_match ) {
			continue;
		}

		if ( ! empty( $id_to_match ) && $layout_template_info['id'] !== $id_to_match ) {
			continue;
		}

		$matching_layout_templates_info[] = $layout_template_info;
	}

	return $matching_layout_templates_info;
}