WP_Font_Face::compile_srcprivateWP 6.4.0

Compiles the src into valid CSS.

Method of the class: WP_Font_Face{}

No Hooks.

Returns

String. The CSS.

Usage

// private - for code of main (parent) class only
$result = $this->compile_src( $value );
$value(array) (required)
Value to process.

Changelog

Since 6.4.0 Introduced.

WP_Font_Face::compile_src() code WP 6.8.1

private function compile_src( array $value ) {
	$src = '';

	foreach ( $value as $item ) {
		$src .= ( 'data' === $item['format'] )
			? ", url({$item['url']})"
			: ", url('{$item['url']}') format('{$item['format']}')";
	}

	$src = ltrim( $src, ', ' );
	return $src;
}