Remove fonts duplication

[MAILPOET-2849]
This commit is contained in:
Pavel Dohnal
2020-06-03 09:14:21 +02:00
committed by Veljko V
parent 27e0f16467
commit 338e223213
6 changed files with 32 additions and 82 deletions

View File

@@ -5,7 +5,7 @@ namespace MailPoet\Form\Util;
use MailPoet\WP\Functions;
class CustomFonts {
const fonts = [
const FONTS = [
'Abril FatFace',
'Alegreya',
'Alegreya Sans',
@@ -81,10 +81,10 @@ class CustomFonts {
$this->wp->wpEnqueueStyle('mailpoet_custom_fonts_css', $this->generateLink());
}
private function generateLink():string {
private function generateLink(): string {
$fonts = array_map(function ($fontName) {
return urlencode($fontName) . ':400,400i,700,700i';
}, self::fonts);
}, self::FONTS);
$fonts = implode('|', $fonts);
return 'https://fonts.googleapis.com/css?family=' . $fonts;
}