Automattic\WooCommerce\LayoutTemplates

LayoutTemplateRegistry::get_matching_layout_templates_info()privateWC 1.0

Get matching layout templates info.

Метод класса: LayoutTemplateRegistry{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_matching_layout_templates_info( $query_params ): array;
$query_params(массив)
Query params.
По умолчанию: array()

Код LayoutTemplateRegistry::get_matching_layout_templates_info() 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;
}