function fontsquirrel_api_preprocess_font__teaser in @font-your-face 8.3
Prepares variables for font teaser preview.
Default template: font--teaser.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.
File
- modules/
fontsquirrel_api/ fontsquirrel_api.module, line 140 - Font Squirrel API module file.
Code
function fontsquirrel_api_preprocess_font__teaser(array &$variables) {
$font = $variables['elements']['#font'];
$metadata = $font
->getMetadata();
if ($font->pid->value == 'fontsquirrel_api' && $font
->isDeactivated()) {
$variables['font_preview']['#markup'] = '<img width="160px" src="https://www.fontsquirrel.com/widgets/test_drive/' . $metadata['checksum'] . '?s=144&t=AaGg" />';
}
}