Automattic\WooCommerce\Blueprint\Exporters

ExportInstallThemeSteps::exportpublicWC 1.0

Export the steps.

Method of the class: ExportInstallThemeSteps{}

No Hooks.

Returns

Array.

Usage

$ExportInstallThemeSteps = new ExportInstallThemeSteps();
$ExportInstallThemeSteps->export();

ExportInstallThemeSteps::export() code WC 9.9.5

public function export() {
	$steps  = array();
	$themes = $this->wp_get_themes();
	if ( is_callable( $this->filter_callback ) ) {
		$themes = call_user_func( $this->filter_callback, $themes );
	}
	$active_theme = $this->wp_get_theme();

	foreach ( $themes as $slug => $theme ) {
		// Check if the theme is active.
		$is_active = $theme->get( 'Name' ) === $active_theme->get( 'Name' );

		$info = $this->wp_themes_api(
			'theme_information',
			array(
				'slug'   => $slug,
				'fields' => array(
					'sections' => false,
				),
			)
		);
		if ( isset( $info->download_link ) ) {
			$steps[] = new InstallTheme(
				$slug,
				'wordpress.org/themes',
				array(
					'activate' => $is_active,
				)
			);
		}
	}

	return $steps;
}