TitanFrameworkOptionFont::generateCustomizerPreviewJS PHP Method

generateCustomizerPreviewJS() public method

Adds the Javascript code that adds Google fonts straight into the customizer preview.
Since: 1.9.2
public generateCustomizerPreviewJS ( ) : void
return void
    public function generateCustomizerPreviewJS()
    {
        ?>
		for ( var fontName in data.google_fonts ) {
			if ( document.querySelector( '#tf-preview-' + fontName ) ) {
				continue;
			}
			var link = document.createElement('LINK');
			link.setAttribute( 'rel', 'stylesheet' );
			link.setAttribute( 'type', 'text/css' );
			link.setAttribute( 'media', 'all' );
			link.setAttribute( 'id', 'tf-preview' + fontName );
			link.setAttribute( 'href', data.google_fonts[ fontName ] );
			document.head.appendChild( link );
		}
		<?php 
    }