Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Make it work with main-v14 #567

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Classes/Backend/Preview/ContainerPreviewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem;
use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridRow;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Core\View\ViewFactoryData;
use TYPO3\CMS\Core\View\ViewFactoryInterface;

class ContainerPreviewRenderer extends StandardContentPreviewRenderer
{
Expand All @@ -47,16 +48,20 @@ class ContainerPreviewRenderer extends StandardContentPreviewRenderer
*/
protected $eventDispatcher;

protected ViewFactoryInterface $viewFactory;

public function __construct(
Registry $tcaRegistry,
ContainerFactory $containerFactory,
NewContentUrlBuilder $newContentUrlBuilder,
EventDispatcherInterface $eventDispatcher
EventDispatcherInterface $eventDispatcher,
ViewFactoryInterface $viewFactory
) {
$this->eventDispatcher = $eventDispatcher;
$this->tcaRegistry = $tcaRegistry;
$this->containerFactory = $containerFactory;
$this->newContentUrlBuilder = $newContentUrlBuilder;
$this->viewFactory = $viewFactory;
}

public function renderPageModulePreviewContent(GridColumnItem $item): string
Expand Down Expand Up @@ -94,10 +99,12 @@ public function renderPageModulePreviewContent(GridColumnItem $item): string
$gridTemplate = $this->tcaRegistry->getGridTemplate($record['CType']);
$partialRootPaths = $this->tcaRegistry->getGridPartialPaths($record['CType']);
$layoutRootPaths = $this->tcaRegistry->getGridLayoutPaths($record['CType']);
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setPartialRootPaths($partialRootPaths);
$view->setLayoutRootPaths($layoutRootPaths);
$view->setTemplatePathAndFilename($gridTemplate);

$view = $this->viewFactory->create(new ViewFactoryData(
partialRootPaths: $partialRootPaths,
layoutRootPaths: $layoutRootPaths,
templatePathAndFilename: $gridTemplate
));

$view->assign('hideRestrictedColumns', (bool)(BackendUtility::getPagesTSconfig($context->getPageId())['mod.']['web_layout.']['hideRestrictedCols'] ?? false));
$view->assign('newContentTitle', $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newContentElement'));
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Factory/ContainerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function workspaceOverlay(array $records): array
$filtered = [];
foreach ($records as $row) {
BackendUtility::workspaceOL('tt_content', $row, $this->workspaceId, true);
if ($row && !VersionState::cast($row['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER)) {
if ($row && VersionState::tryFrom($row['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) {
$filtered[] = $row;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Factory/PageView/Backend/ContentStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function workspaceOverlay(array $records): array
$filtered = [];
foreach ($records as $row) {
BackendUtility::workspaceOL('tt_content', $row, $this->workspaceId, true);
if ($row && !VersionState::cast($row['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER)) {
if ($row && VersionState::tryFrom($row['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) {
$filtered[] = $row;
}
}
Expand All @@ -32,7 +32,7 @@ public function workspaceOverlay(array $records): array
public function containerRecordWorkspaceOverlay(array $record): ?array
{
BackendUtility::workspaceOL('tt_content', $record, $this->workspaceId, false);
if ($record && !VersionState::cast($record['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER)) {
if ($record && VersionState::tryFrom($row['t3ver_state'] ?? 0) !== VersionState::DELETE_PLACEHOLDER) {
return $record;
}
return null;
Expand Down
10 changes: 5 additions & 5 deletions Classes/Events/BeforeContainerPreviewIsRenderedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
use B13\Container\Domain\Model\Container;
use TYPO3\CMS\Backend\View\BackendLayout\Grid\Grid;
use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Core\View\ViewInterface;

final class BeforeContainerPreviewIsRenderedEvent
{
protected Container $container;

protected StandaloneView $view;
protected ViewInterface $view;

protected Grid $grid;

protected GridColumnItem $item;

public function __construct(Container $container, StandaloneView $view, Grid $grid, GridColumnItem $item)
public function __construct(Container $container, ViewInterface $view, Grid $grid, GridColumnItem $item)
{
$this->container = $container;
$this->view = $view;
Expand All @@ -40,7 +40,7 @@ public function getContainer(): Container
return $this->container;
}

public function getView(): StandaloneView
public function getView(): ViewInterface
{
return $this->view;
}
Expand Down
Loading