Automattic\WooCommerce\Admin\Features\Blueprint

Init::get_themes_for_export_grouppublicWC 1.0

Get themes for export group.

Method of the class: Init{}

No Hooks.

Returns

Array. $themes

Usage

$Init = new Init();
$Init->get_themes_for_export_group();

Init::get_themes_for_export_group() code WC 9.9.5

public function get_themes_for_export_group() {
	$themes       = $this->wp_get_themes();
	$active_theme = $this->wp_get_theme();

	$themes = array_map(
		function ( $theme ) use ( $active_theme ) {
			return array(
				'id'      => $theme->get_stylesheet(),
				'label'   => $theme->get( 'Name' ),
				'checked' => $theme->get_stylesheet() === $active_theme->get_stylesheet(),
			);
		},
		$themes
	);

	usort(
		$themes,
		function ( $a, $b ) {
			return $b['checked'] <=> $a['checked'];
		}
	);

	return array_values( $themes );
}