diff --git a/Classes/Controller/ListByCategoryController.php b/Classes/Controller/ListByCategoryController.php index d43af3609ef721d6310c91d0724f613c21e6758f..98f43db270ac71c899ec4b27bae9203b3b8d7b57 100644 --- a/Classes/Controller/ListByCategoryController.php +++ b/Classes/Controller/ListByCategoryController.php @@ -26,7 +26,7 @@ namespace SGalinski\SgNews\Controller; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use SGalinski\ProjectBase\Service\HeaderMetaDataService; +use SGalinski\SgNews\Service\HeaderMetaDataService; use SGalinski\SgNews\Domain\Model\News; use TYPO3\CMS\Core\Utility\GeneralUtility; diff --git a/Classes/Controller/OverviewController.php b/Classes/Controller/OverviewController.php index 7e65dc46ed6e1e4c64db65a12a60f2475e4b3b86..5dcd3f382e8eae6de545c67e0908a74fce54d460 100644 --- a/Classes/Controller/OverviewController.php +++ b/Classes/Controller/OverviewController.php @@ -26,7 +26,7 @@ namespace SGalinski\SgNews\Controller; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use SGalinski\ProjectBase\Service\HeaderMetaDataService; +use SGalinski\SgNews\Service\HeaderMetaDataService; use SGalinski\SgNews\Domain\Model\Category; use SGalinski\SgNews\Domain\Model\News; use TYPO3\CMS\Core\Utility\GeneralUtility; diff --git a/Classes/Controller/SingleViewController.php b/Classes/Controller/SingleViewController.php index c0d3c97411a2ac6cd0f076da8f7f8d823f1d8609..1e89a6171d4eac8496b4595ea2e954a41a0388bb 100644 --- a/Classes/Controller/SingleViewController.php +++ b/Classes/Controller/SingleViewController.php @@ -26,7 +26,7 @@ namespace SGalinski\SgNews\Controller; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use SGalinski\ProjectBase\Service\HeaderMetaDataService; +use SGalinski\SgNews\Service\HeaderMetaDataService; use SGalinski\SgNews\Domain\Model\Category; use SGalinski\SgNews\Domain\Model\News; use TYPO3\CMS\Core\Page\PageRenderer; diff --git a/Classes/Service/HeaderMetaDataService.php b/Classes/Service/HeaderMetaDataService.php new file mode 100644 index 0000000000000000000000000000000000000000..87ab25ef308fff5bdf04668c8fd8384cc8e163c1 --- /dev/null +++ b/Classes/Service/HeaderMetaDataService.php @@ -0,0 +1,50 @@ +<?php + +namespace SGalinski\SgNews\Service; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; + +/** + * Service class for the meta data within the header + */ +class HeaderMetaDataService { + /** + * Sets the data for the og:image meta data header tag. + * + * @param string $path + * @return void + */ + public static function addOgImageToHeader($path) { + if (strlen($path) <= 0) { + return; + } + + /** @var $typoScriptController TypoScriptFrontendController */ + $typoScriptController = $GLOBALS['TSFE']; + $typoScriptController->page['og_image_path_by_extension'] = $path; + } +}