Skip to content

Commit

Permalink
Fix issue value font is null
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Nov 8, 2023
1 parent b29120a commit 8533662
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions framework/library/astroid/Helper/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,12 @@ public static function loadGoogleFont($value)
$value = str_replace($wght, implode(';', $_value), $value);
}

$wa->registerAndUseStyle('astroid.googlefont', 'https://fonts.gstatic.com', ['version' => 'auto'], ['rel' => 'preconnect']);
$wa->registerAndUseStyle('astroid.googlefont.'.$value, 'https://fonts.googleapis.com/css2?family=' . $value . '&display=swap');
if ($value) {
$wa->registerAndUseStyle('astroid.googlefont', 'https://fonts.gstatic.com', ['version' => 'auto'], ['rel' => 'preconnect']);
$wa->registerAndUseStyle('astroid.googlefont.'.$value, 'https://fonts.googleapis.com/css2?family=' . $value . '&display=swap');
} else {
return '';
}

@list($font, $variants) = explode(":", $value);

Expand All @@ -274,7 +278,6 @@ public static function loadGoogleFont($value)
public static function loadLocalFont($value)
{
$template = Framework::getTemplate();
$document = Framework::getDocument();
$document = Factory::getApplication()->getDocument();
$wa = $document->getWebAssetManager();
$uploaded_fonts = $template->getFonts();
Expand Down

0 comments on commit 8533662

Please sign in to comment.