public static function fetch_google_fonts( $api_key = null ) {
		$raw_fonts = static::request_google_fonts( $api_key );

		// Invalid API key or something else.
		if ( ! is_array( $raw_fonts ) || ! isset( $raw_fonts['items'] ) ) {
			return [];
		}

		$fonts = [];

		foreach ( $raw_fonts['items'] as $item ) {
			if ( ! isset( $item['kind'] ) || 'webfonts#webfont' !== $item['kind'] ) {
				continue;
			}

			$fonts[] = Arr::only( $item, [ 'family', 'category', 'variants', 'subset' ] );
		}

		static::flush_transients();
		static::set_transients( $fonts );

		return $fonts;
	}
public static function fetch_google_fonts( $api_key = null ) {
		$raw_fonts = static::request_google_fonts( $api_key );

		// Invalid API key or something else.
		if ( ! is_array( $raw_fonts ) || ! isset( $raw_fonts['items'] ) ) {
			return [];
		}

		$fonts = [];

		foreach ( $raw_fonts['items'] as $item ) {
			if ( ! isset( $item['kind'] ) || 'webfonts#webfont' !== $item['kind'] ) {
				continue;
			}

			$fonts[] = Arr::only( $item, [ 'family', 'category', 'variants', 'subset' ] );
		}

		static::flush_transients();
		static::set_transients( $fonts );

		return $fonts;
	}
public static function fetch_google_fonts ( $ api_key = null ) { $ raw_fonts = static :: request_google_fonts ( $ api_key ) ; // Invalid API key or something else. if ( ! is_array ( $ raw_fonts ) || ! isset ( $ raw_fonts [ 'items' ] ) ) { return [ ] ; } $ fonts = [ ] ; foreach ( $ raw_fonts [ 'items' ] as $ item ) { if ( ! isset ( $ item [ 'kind' ] ) || 'webfonts#webfont' !== $ item [ 'kind' ] ) { continue ; } $ fonts [ ] = Arr :: only ( $ item , [ 'family' , 'category' , 'variants' , 'subset' ] ) ; } static :: flush_transients ( ) ; static :: set_transients ( $ fonts ) ; return $ fonts ; }
Get list of fonts from Google Fonts.

@param  string $api_key The Google Fonts API key.
@return array|false
Get list of fonts from Google Fonts .