From 2ae81ad07b2c693ee067381b1b774b1510cb0e28 Mon Sep 17 00:00:00 2001 From: Alexander Schwirjow Date: Tue, 6 Apr 2021 16:54:13 +0200 Subject: [PATCH] Adopt to the new contao version --- .php_cs.dist | 24 +------------------ CHANGELOG.md | 6 ++++- src/Resources/contao/classes/FontFaces.php | 2 +- src/Resources/contao/classes/FontImport.php | 2 +- src/Resources/contao/config/config.php | 1 + src/Resources/contao/dca/tl_layout.php | 2 +- .../public/css/webfont-hanken-grotesk.css | 2 ++ 7 files changed, 12 insertions(+), 27 deletions(-) create mode 100644 src/Resources/public/css/webfont-hanken-grotesk.css diff --git a/.php_cs.dist b/.php_cs.dist index 72d3bc0..bb2e17c 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -5,26 +5,4 @@ This file is part of Contao Webfont Generator Bundle @license LGPL-3.0-or-later EOF; return PhpCsFixer\Config::create() - ->setRules([ - //'@Symfony' => true, - '@PSR2' => true, - '@PHP71Migration' => true, - 'align_multiline_comment' => true, - 'combine_consecutive_issets' => true, - 'combine_consecutive_unsets' => true, - 'compact_nullable_typehint' => true, - 'linebreak_after_opening_tag' => true, - 'no_null_property_initialization' => true, - 'no_superfluous_elseif' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'ordered_class_elements' => true, - 'ordered_imports' => true, - 'phpdoc_add_missing_param_annotation' => true, - 'phpdoc_order' => true, - 'phpdoc_types_order' => [ - 'null_adjustment' => 'always_last', - 'sort_algorithm' => 'none', - ], - ]) -; \ No newline at end of file + ->setRules(['@PSR12' => true]); \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c4ec4f4..c072ba4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,4 +38,8 @@ - ADD: More comments in code #### 0.8.0 -- ADD: Localfallback option, see https://www.paulirish.com/2009/bulletproof-font-face-implementation-syntax/ for details \ No newline at end of file +- ADD: Localfallback option, see https://www.paulirish.com/2009/bulletproof-font-face-implementation-syntax/ for details + +#### 1.0.0 +- Apply PSR12 fixes only, KISS +- Contao 4.11 Support \ No newline at end of file diff --git a/src/Resources/contao/classes/FontFaces.php b/src/Resources/contao/classes/FontFaces.php index ed9016f..cd45dc6 100644 --- a/src/Resources/contao/classes/FontFaces.php +++ b/src/Resources/contao/classes/FontFaces.php @@ -86,7 +86,7 @@ public function saveFontFaces($value) \System::log('Database structure is not up to date, fonts can not be generated', __METHOD__, TL_GENERAL); return; } - + $fontPath = $this->generateFilePath($fontFace->name); if (file_exists("web/".$fontPath)) { if (!$this->Files->is_writeable($fontPath)) { diff --git a/src/Resources/contao/classes/FontImport.php b/src/Resources/contao/classes/FontImport.php index f877363..dccfab0 100644 --- a/src/Resources/contao/classes/FontImport.php +++ b/src/Resources/contao/classes/FontImport.php @@ -86,7 +86,7 @@ public function importFont() $this->Database->prepare('DELETE FROM `tl_fonts` WHERE `pid` = ?')->execute($parentId); } } - + if (!$parentId) { \Message::addError($GLOBALS['TL_LANG']['tl_fonts_faces']['parent_record_error']); continue; diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index 7d317f1..38c7f04 100755 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -1,4 +1,5 @@ array('tl_fonts_faces', 'tl_fonts'), diff --git a/src/Resources/contao/dca/tl_layout.php b/src/Resources/contao/dca/tl_layout.php index 783f01e..b8a1a26 100644 --- a/src/Resources/contao/dca/tl_layout.php +++ b/src/Resources/contao/dca/tl_layout.php @@ -1,6 +1,6 @@ &$GLOBALS['TL_LANG']['tl_layout']['fontfaces'], diff --git a/src/Resources/public/css/webfont-hanken-grotesk.css b/src/Resources/public/css/webfont-hanken-grotesk.css new file mode 100644 index 0000000..d6300b5 --- /dev/null +++ b/src/Resources/public/css/webfont-hanken-grotesk.css @@ -0,0 +1,2 @@ +@font-face{font-family:'Hanken Grotesk';src:local('☺︎'),url('https://www.schwirjow.de/files/poirot/fonts/hk-grotesk/HankenGrotesk-Bold.otf') format('opentype');font-weight:bold;}@font-face{font-family:'Hanken Grotesk';src:local('☺︎'),url('https://www.schwirjow.de/files/poirot/fonts/hk-grotesk/HankenGrotesk-Regular.otf') format('opentype');} +h1,h2,h3{font-family:'Hanken Grotesk', 'sans-serif';font-weight:bold;}body{font-family:'Hanken Grotesk', 'sans-serif';}