Automattic\WooCommerce\Blueprint\ResourceStorages

OrgThemeResourceStorage{}WC 1.0└─ OrgPluginResourceStorage

Class OrgThemeResourceStorage

Хуков нет.

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

$OrgThemeResourceStorage = new OrgThemeResourceStorage();
// use class methods

Методы

  1. public get_supported_resource()
  2. protected get_download_link( $slug )

Код OrgThemeResourceStorage{} WC 10.0.2

class OrgThemeResourceStorage extends OrgPluginResourceStorage {
	/**
	 * Get the download link.
	 *
	 * @param string $slug The slug of the theme to be downloaded.
	 *
	 * @return string|null The download link.
	 */
	protected function get_download_link( $slug ): ?string {
		$info = $this->wp_themes_api(
			'theme_information',
			array(
				'slug'   => $slug,
				'fields' => array(
					'sections' => false,
				),
			)
		);

		if ( is_wp_error( $info ) ) {
			return null;
		}

		if ( isset( $info->download_link ) ) {
			return $info->download_link;
		}

		return null;
	}

	/**
	 * Get the supported resource.
	 *
	 * @return string The supported resource.
	 */
	public function get_supported_resource(): string {
		return 'wordpress.org/themes';
	}
}