Astra_Fonts::add_font( string $name, array $variants = array() )
Adds data to the $fonts array for a font to be rendered.
Description
Parameters
- $name
-
(string) (Required) The name key of the font to add.
- $variants
-
(array) (Optional) An array of weight variants.
Default value: array()
Return
(void)
Source
File: inc/customizer/class-astra-fonts.php
public static function add_font( $name, $variants = array() ) { if ( 'inherit' == $name ) { return; } if ( ! is_array( $variants ) ) { // For multiple variant selectons for fonts. $variants = explode( ',', str_replace( 'italic', 'i', $variants ) ); } if ( is_array( $variants ) ) { $key = array_search( 'inherit', $variants ); if ( false !== $key ) { unset( $variants[ $key ] ); if ( ! in_array( 400, $variants ) ) { $variants[] = 400; } } } elseif ( 'inherit' == $variants ) { $variants = 400; } if ( isset( self::$fonts[ $name ] ) ) { foreach ( (array) $variants as $variant ) { if ( ! in_array( $variant, self::$fonts[ $name ]['variants'] ) ) { self::$fonts[ $name ]['variants'][] = $variant; } } } else { self::$fonts[ $name ] = array( 'variants' => (array) $variants, ); } }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |