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] Initial TYPO3 v14 compatibility #1528

Open
wants to merge 13 commits 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
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ jobs:
fail-fast: false
max-parallel: 5
matrix:
typo3: ['^12', '^13', '13.4.x-dev']
typo3: ['^13', '13.4.x-dev', '14.0.x-dev']
php: ['8.2', '8.3']
include:
- typo3: '^12'
php: '8.1'

steps:
- id: checkout
name: Checkout Code
Expand Down
145 changes: 0 additions & 145 deletions Build/phpstan-baseline-v13.neon

This file was deleted.

1 change: 0 additions & 1 deletion Build/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ includes:
- %currentWorkingDirectory%/.build/vendor/phpstan/phpstan-strict-rules/rules.neon
- %currentWorkingDirectory%/.build/vendor/phpstan/phpstan-deprecation-rules/rules.neon
- %currentWorkingDirectory%/.build/vendor/friendsoftypo3/phpstan-typo3/extension.neon
- %currentWorkingDirectory%/Build/phpstan-baseline-v13.neon

parameters:
level: 8
Expand Down
28 changes: 16 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 All @@ -34,6 +36,11 @@ class PaginateViewHelper extends AbstractViewHelper
*/
protected $escapeOutput = false;

public function __construct(
protected readonly ViewFactoryInterface $viewFactory,
) {
}

public function initializeArguments(): void
{
parent::initializeArguments();
Expand Down Expand Up @@ -78,7 +85,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 +106,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 +117,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 +139,12 @@ protected function getTemplateObject(RenderingContextInterface $renderingContext
}
}

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

return $view;
return $this->viewFactory->create(new ViewFactoryData(
templateRootPaths: $templateRootPaths,
partialRootPaths: $partialRootPaths,
layoutRootPaths: $layoutRootPaths,
request: $request,
));
}

protected function getConfigurationManager(): ConfigurationManagerInterface
Expand Down
12 changes: 4 additions & 8 deletions Classes/ViewHelpers/File/IsAudioViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\FileType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

Expand All @@ -25,16 +26,11 @@ public function render()
$allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['SYS']['audiofile_ext'] ?? '';
$allowedFileExtensions = GeneralUtility::trimExplode(',', $allowedFileExtensions);

if (is_object($file)
return is_object($file)
&& ($file instanceof FileReference || $file instanceof File)
&& (
in_array($file->getExtension(), $allowedFileExtensions, true)
|| $file->getType() === File::FILETYPE_AUDIO
)
) {
return true;
}

return false;
|| $file->getType() === FileType::AUDIO->value
);
}
}
12 changes: 4 additions & 8 deletions Classes/ViewHelpers/File/IsImageViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\FileType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

Expand All @@ -25,16 +26,11 @@ public function render()
$allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ?? '';
$allowedFileExtensions = GeneralUtility::trimExplode(',', $allowedFileExtensions);

if (is_object($file)
return is_object($file)
&& ($file instanceof FileReference || $file instanceof File)
&& (
in_array($file->getExtension(), $allowedFileExtensions, true)
|| $file->getType() === File::FILETYPE_IMAGE
)
) {
return true;
}

return false;
|| $file->getType() === FileType::IMAGE->value
);
}
}
12 changes: 4 additions & 8 deletions Classes/ViewHelpers/File/IsMediaViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\FileType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

Expand All @@ -25,16 +26,11 @@ public function render()
$allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'] ?? '';
$allowedFileExtensions = GeneralUtility::trimExplode(',', $allowedFileExtensions);

if (is_object($file)
return is_object($file)
&& ($file instanceof FileReference || $file instanceof File)
&& (
in_array($file->getExtension(), $allowedFileExtensions, true)
|| $file->getType() === File::FILETYPE_VIDEO
)
) {
return true;
}

return false;
|| $file->getType() === FileType::VIDEO->value
);
}
}
Loading