Skip to content

Commit

Permalink
[BUGFIX] Replace NullSite with PseudoSiteFinder
Browse files Browse the repository at this point in the history
NullSite was failing as it was missing the `use` statement at the top.

This replaces NullSite with using the PseudoSiteFinder as it returns a
more robust "site" instance - as used in the core SiteMatcher class in
the `matchByPageId` method

Resolves: #321
Releases: 8.0.0 7.3.6
  • Loading branch information
mikestreety committed Nov 22, 2021
1 parent 547d86b commit a0d8eff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Classes/Utility/TemplaVoilaUtility.php
Expand Up @@ -22,6 +22,7 @@
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Site\PseudoSiteFinder;

/**
* Class with static functions for templavoila.
Expand Down Expand Up @@ -206,7 +207,8 @@ public static function getUseableLanguages(int $pageId = 0)
try {
$site = $siteFinder->getSiteByPageId((int)$pageId);
} catch (\TYPO3\CMS\Core\Exception\SiteNotFoundException $e) {
$site = new NullSite();
$pseudoSiteFinder = GeneralUtility::makeInstance(PseudoSiteFinder::class);
$site = $pseudoSiteFinder->getSiteByPageId($pageId);
}
if ($backendUserAuth) {
$foundLanguages = $site->getAvailableLanguages($backendUserAuth);
Expand Down

0 comments on commit a0d8eff

Please sign in to comment.