Skip to content

Commit

Permalink
[TASK] Migrate to use ViewFactoryInterface
Browse files Browse the repository at this point in the history
Adjusts v14 breaking changes
  • Loading branch information
ohader committed Oct 28, 2024
1 parent cafb0b3 commit 330796b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
23 changes: 11 additions & 12 deletions Classes/ViewHelpers/Data/PaginateViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
use TYPO3\CMS\Core\Pagination\SimplePagination;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\View\ViewFactoryData;
use TYPO3\CMS\Core\View\ViewFactoryInterface;
use TYPO3\CMS\Core\View\ViewInterface;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Pagination\QueryResultPaginator;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

Expand Down Expand Up @@ -78,7 +80,7 @@ public function render(): string
'pagination' => $pagination,
'configuration' => $configuration,
]);
$paginationRendered = $paginationView->render();
$paginationRendered = $paginationView->render('Paginate/Index');

$variableProvider = $renderingContext->getVariableProvider();
$variableProvider->add('paginator', $paginator);
Expand All @@ -99,7 +101,7 @@ public function render(): string
);
}

protected function getTemplateObject(RenderingContextInterface $renderingContext, ServerRequestInterface $request): StandaloneView
protected function getTemplateObject(RenderingContextInterface $renderingContext, ServerRequestInterface $request): ViewInterface
{
$setup = $this->getConfigurationManager()->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);

Expand All @@ -110,9 +112,6 @@ protected function getTemplateObject(RenderingContextInterface $renderingContext
$context->setRequest($request);
}

/** @var StandaloneView $view */
$view = GeneralUtility::makeInstance(StandaloneView::class, $context);

$layoutRootPaths = [];
$layoutRootPaths[] = GeneralUtility::getFileAbsFileName('EXT:bootstrap_package/Resources/Private/Layouts/ViewHelpers/');
if (isset($setup['plugin.']['tx_bootstrappackage.']['view.']['layoutRootPaths.'])) {
Expand All @@ -135,12 +134,12 @@ protected function getTemplateObject(RenderingContextInterface $renderingContext
}
}

$view->setLayoutRootPaths($layoutRootPaths);
$view->setPartialRootPaths($partialRootPaths);
$view->setTemplateRootPaths($templateRootPaths);
$view->setTemplate('Paginate/Index');

return $view;
return GeneralUtility::makeInstance(ViewFactoryInterface::class)

Check failure on line 137 in Classes/ViewHelpers/Data/PaginateViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Call to method create() on an unknown class TYPO3\CMS\Core\View\ViewFactoryInterface.

Check failure on line 137 in Classes/ViewHelpers/Data/PaginateViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Class TYPO3\CMS\Core\View\ViewFactoryInterface not found.

Check failure on line 137 in Classes/ViewHelpers/Data/PaginateViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Call to method create() on an unknown class TYPO3\CMS\Core\View\ViewFactoryInterface.

Check failure on line 137 in Classes/ViewHelpers/Data/PaginateViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Class TYPO3\CMS\Core\View\ViewFactoryInterface not found.

Check failure on line 137 in Classes/ViewHelpers/Data/PaginateViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Call to method create() on an unknown class TYPO3\CMS\Core\View\ViewFactoryInterface.

Check failure on line 137 in Classes/ViewHelpers/Data/PaginateViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Class TYPO3\CMS\Core\View\ViewFactoryInterface not found.
->create(new ViewFactoryData(

Check failure on line 138 in Classes/ViewHelpers/Data/PaginateViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Instantiated class TYPO3\CMS\Core\View\ViewFactoryData not found.

Check failure on line 138 in Classes/ViewHelpers/Data/PaginateViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Instantiated class TYPO3\CMS\Core\View\ViewFactoryData not found.

Check failure on line 138 in Classes/ViewHelpers/Data/PaginateViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Instantiated class TYPO3\CMS\Core\View\ViewFactoryData not found.
templateRootPaths: $templateRootPaths,
partialRootPaths: $partialRootPaths,
layoutRootPaths: $layoutRootPaths,
));
}

protected function getConfigurationManager(): ConfigurationManagerInterface
Expand Down
22 changes: 11 additions & 11 deletions Classes/ViewHelpers/FrameViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\View\ViewFactoryData;
use TYPO3\CMS\Core\View\ViewFactoryInterface;
use TYPO3\CMS\Core\View\ViewInterface;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

/**
Expand Down Expand Up @@ -162,10 +164,10 @@ public function render()
]
);

return $view->render();
return $view->render('Frame/Index');
}

protected static function getTemplateObject(): StandaloneView
protected static function getTemplateObject(): ViewInterface
{
$setup = static::getConfigurationManager()->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);

Expand All @@ -191,14 +193,12 @@ protected static function getTemplateObject(): StandaloneView
}
}

/** @var StandaloneView $view */
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setLayoutRootPaths($layoutRootPaths);
$view->setPartialRootPaths($partialRootPaths);
$view->setTemplateRootPaths($templateRootPaths);
$view->setTemplate('Frame/Index');

return $view;
return GeneralUtility::makeInstance(ViewFactoryInterface::class)

Check failure on line 196 in Classes/ViewHelpers/FrameViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.2)

Call to method create() on an unknown class TYPO3\CMS\Core\View\ViewFactoryInterface.

Check failure on line 196 in Classes/ViewHelpers/FrameViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.3)

Call to method create() on an unknown class TYPO3\CMS\Core\View\ViewFactoryInterface.

Check failure on line 196 in Classes/ViewHelpers/FrameViewHelper.php

View workflow job for this annotation

GitHub Actions / Build PHP (^12, 8.1)

Call to method create() on an unknown class TYPO3\CMS\Core\View\ViewFactoryInterface.
->create(new ViewFactoryData(
templateRootPaths: $templateRootPaths,
partialRootPaths: $partialRootPaths,
layoutRootPaths: $layoutRootPaths,
));
}

protected static function getConfigurationManager(): ConfigurationManagerInterface
Expand Down

0 comments on commit 330796b

Please sign in to comment.