-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Introduce XCLASS for frontendcontroller to ensure loading of…
… tsconfig in FE
- Loading branch information
1 parent
f4ed886
commit 1ca5249
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
Classes/Frontend/Controller/TypoScriptFrontendController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Meteko\Autosite\Frontend\Controller; | ||
|
||
use TYPO3\CMS\Core\Package\Package; | ||
use TYPO3\CMS\Core\Package\PackageManager; | ||
use TYPO3\CMS\Core\Site\Entity\Site; | ||
use TYPO3\CMS\Core\Site\SiteFinder; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
class TypoScriptFrontendController extends \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController { | ||
|
||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getPagesTSconfig() | ||
{ | ||
/** @var SiteFinder $siteFinder */ | ||
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class); | ||
foreach ($this->rootLine as $key => $value) { | ||
$site = $siteFinder->getSiteByPageId($value['uid']); | ||
|
||
if (!($site instanceof Site)) { | ||
continue; | ||
} | ||
|
||
/** @var PackageManager $packageManager */ | ||
$packageManager = GeneralUtility::makeInstance(PackageManager::class); | ||
/** @var Package $package */ | ||
$package = $packageManager->getPackage($site->getIdentifier()); | ||
$tsConfigFile = $package->getPackagePath() . 'Configuration/PageTS/main.tsconfig'; | ||
if (file_exists($tsConfigFile)) { | ||
$fileContents = @file_get_contents($tsConfigFile); | ||
$this->rootLine[$key]['TSconfig'] .= LF . $fileContents; | ||
} | ||
} | ||
|
||
return parent::getPagesTSconfig(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters