function fontsquirrel_api_preprocess_font in @font-your-face 8.3
Prepares variables for Font templates.
Default template: font.html.twig.
Parameters
array $variables: An associative array containing:
- elements: An associative array containing the user information and any
- attributes: HTML attributes for the containing element.
1 call to fontsquirrel_api_preprocess_font()
- fontsquirrel_api_preprocess_font__full in modules/
fontsquirrel_api/ fontsquirrel_api.module - Prepares variables for full font template preview.
File
- modules/
fontsquirrel_api/ fontsquirrel_api.module, line 108 - Font Squirrel API module file.
Code
function fontsquirrel_api_preprocess_font(array &$variables) {
$font = $variables['elements']['#font'];
$metadata = $font
->getMetadata();
if ($font->pid->value == 'fontsquirrel_api' && $font
->isDeactivated()) {
$variables['font_preview']['#markup'] = '<img style=\'max-width:100%;\' src="' . $metadata['preview_image'] . '" />';
}
}