Skip to content

Commit

Permalink
[BUGFIX] Do not use AdminPanel reference in EXT:frontend code
Browse files Browse the repository at this point in the history
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/+/66588
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
bmack committed Nov 16, 2020
1 parent 444b05e commit f2ff23e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions typo3/sysext/core/Classes/Context/VisibilityAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public function get(string $name)
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;
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/frontend/Classes/Middleware/PreviewSimulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
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;
Expand Down Expand Up @@ -58,7 +57,8 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
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);
}
Expand Down

0 comments on commit f2ff23e

Please sign in to comment.