packages/kirki-framework/module-webfonts/src/Google.php
public function process_fonts() {

		// Early exit if font-family is empty.
		if ( empty( $this->fonts ) ) {
			return;
		}

		foreach ( $this->fonts as $font => $variants ) {

			// Determine if this is indeed a google font or not.
			// If it's not, then just remove it from the array.
			if ( ! array_key_exists( $font, $this->google_fonts ) ) {
				unset( $this->fonts[ $font ] );
				continue;
			}

			// Get all valid font variants for this font.
			$font_variants = [];
			if ( isset( $this->google_fonts[ $font ]['variants'] ) ) {
				$font_variants = $this->google_fonts[ $font ]['variants'];
			}
			foreach ( $variants as $variant ) {

				// If this is not a valid variant for this font-family
				// then unset it and move on to the next one.
				if ( ! in_array( strval( $variant ), $font_variants, true ) ) {
					$variant_key = array_search( $variant, $this->fonts[ $font ], true );
					unset( $this->fonts[ $font ][ $variant_key ] );
					continue;
				}
			}
		}
	}
public function process_fonts() {

		// Early exit if font-family is empty.
		if ( empty( $this->fonts ) ) {
			return;
		}

		foreach ( $this->fonts as $font => $variants ) {

			// Determine if this is indeed a google font or not.
			// If it's not, then just remove it from the array.
			if ( ! array_key_exists( $font, $this->google_fonts ) ) {
				unset( $this->fonts[ $font ] );
				continue;
			}

			// Get all valid font variants for this font.
			$font_variants = [];
			if ( isset( $this->google_fonts[ $font ]['variants'] ) ) {
				$font_variants = $this->google_fonts[ $font ]['variants'];
			}
			foreach ( $variants as $variant ) {

				// If this is not a valid variant for this font-family
				// then unset it and move on to the next one.
				if ( ! in_array( strval( $variant ), $font_variants, true ) ) {
					$variant_key = array_search( $variant, $this->fonts[ $font ], true );
					unset( $this->fonts[ $font ][ $variant_key ] );
					continue;
				}
			}
		}
	}
public function process_fonts ( ) { // Early exit if font-family is empty. if ( empty ( $ this -> fonts ) ) { return ; } foreach ( $ this -> fonts as $ font => $ variants ) { // Determine if this is indeed a google font or not. // If it's not, then just remove it from the array. if ( ! array_key_exists ( $ font , $ this -> google_fonts ) ) { unset ( $ this -> fonts [ $ font ] ) ; continue ; } // Get all valid font variants for this font. $ font_variants = [ ] ; if ( isset ( $ this -> google_fonts [ $ font ] [ 'variants' ] ) ) { $ font_variants = $ this -> google_fonts [ $ font ] [ 'variants' ] ; } foreach ( $ variants as $ variant ) { // If this is not a valid variant for this font-family // then unset it and move on to the next one. if ( ! in_array ( strval ( $ variant ) , $ font_variants , true ) ) { $ variant_key = array_search ( $ variant , $ this -> fonts [ $ font ] , true ) ; unset ( $ this -> fonts [ $ font ] [ $ variant_key ] ) ; continue ; } } } }
Determines the vbalidity of the selected font as well as its properties.
This is vital to make sure that the google-font script that we'll generate later
does not contain any invalid options.
Determines the vbalidity of the selected font as well as its properties . This is vital to make sure that the google - font script that we ll generate later does not contain any invalid options .