Commit 2f780fbd authored by Benni Mack's avatar Benni Mack Committed by Georg Ringer
Browse files

[BUGFIX] Do not use AdminPanel reference in EXT:frontend code

With this change an undefined symbol is included when not having
AdminPanel loaded: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66218

This change aims to change the logic for checking if the preview
flag is enabled.

Resolves: #92746
Reverts: #92242
Releases: master, 10.4, 9.5
Change-Id: I1005424a86f1ced595b23938bd6dcc70ff2f00c9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66372


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent f4b38502
......@@ -76,6 +76,11 @@ class VisibilityAspect implements AspectInterface
throw new AspectPropertyNotFoundException('Property "' . $name . '" not found in Aspect "' . __CLASS__ . '".', 1527780439);
}
public function includeHidden(): bool
{
return $this->includeHiddenContent || $this->includeHiddenPages;
}
public function includeHiddenPages(): bool
{
return $this->includeHiddenPages;
......
......@@ -21,7 +21,6 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use TYPO3\CMS\Adminpanel\Utility\StateUtility;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\DateTimeAspect;
use TYPO3\CMS\Core\Context\UserAspect;
......@@ -58,7 +57,8 @@ class PreviewSimulator implements MiddlewareInterface
if ((bool)$this->context->getPropertyFromAspect('backend.user', 'isLoggedIn', false)) {
$simulatingDate = $this->simulateDate($request);
$simulatingGroup = $this->simulateUserGroup($request);
$isPreview = (int)($simulatingDate || $simulatingGroup || StateUtility::isActivatedForUser());
$showHiddenRecords = ($this->context->hasAspect('visibility') ? $this->context->getAspect('visibility')->includeHidden() : false);
$isPreview = (int)($simulatingDate || $simulatingGroup || $showHiddenRecords);
$previewAspect = GeneralUtility::makeInstance(PreviewAspect::class, $isPreview);
$this->context->setAspect('frontend.preview', $previewAspect);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment