Skip to content

Commit

Permalink
[WIP] Compatibility with TYPO3 v13
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessCoder committed Jan 22, 2025
1 parent cf49f7a commit 50055a8
Show file tree
Hide file tree
Showing 75 changed files with 748 additions and 324 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ jobs:
typo3: "^12.4"
- php: "8.3"
typo3: "^12.4"
- php: "8.3"
typo3: "^13.4"

runs-on: ubuntu-latest

Expand Down Expand Up @@ -107,6 +109,8 @@ jobs:
typo3: "^12.4"
- php: "8.3"
typo3: "^12.4"
- php: "8.3"
typo3: "^13.4"

runs-on: ubuntu-latest

Expand All @@ -132,7 +136,9 @@ jobs:
run: vendor/bin/phpunit --coverage-clover=build/logs/clover.xml

- name: Upload test coverage
run: vendor/bin/php-coveralls -vvv
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
env:
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: typo3-${{ matrix.typo3 }}-php-${{ matrix.php }}
Expand Down
6 changes: 5 additions & 1 deletion Classes/Backend/BackendLayoutDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use FluidTYPO3\Flux\Provider\PageProvider;
use FluidTYPO3\Flux\Provider\ProviderInterface;
use FluidTYPO3\Flux\Provider\ProviderResolver;
use FluidTYPO3\Flux\Proxy\DataProviderContextProxy;
use FluidTYPO3\Flux\Service\WorkspacesAwareRecordService;
use TYPO3\CMS\Backend\View\BackendLayout\BackendLayout;
use TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection;
Expand All @@ -34,7 +35,10 @@ public function addBackendLayouts(
DataProviderContext $dataProviderContext,
BackendLayoutCollection $backendLayoutCollection
): void {
$backendLayout = $this->getBackendLayout('grid', $dataProviderContext->getPageId());
$backendLayout = $this->getBackendLayout(
'grid',
DataProviderContextProxy::readPageUidFromObject($dataProviderContext)
);
if ($backendLayout) {
$backendLayoutCollection->add($backendLayout);
}
Expand Down
6 changes: 3 additions & 3 deletions Classes/Backend/PageLayoutDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

use FluidTYPO3\Flux\Enum\FormOption;
use FluidTYPO3\Flux\Form;
use FluidTYPO3\Flux\Proxy\SiteFinderProxy;
use FluidTYPO3\Flux\Service\PageService;
use FluidTYPO3\Flux\Utility\ExtensionNamingUtility;
use FluidTYPO3\Flux\Utility\MiscellaneousUtility;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
Expand All @@ -24,12 +24,12 @@ class PageLayoutDataProvider
{
private ConfigurationManagerInterface $configurationManager;
private PageService $pageService;
private SiteFinder $siteFinder;
private SiteFinderProxy $siteFinder;

public function __construct(
ConfigurationManagerInterface $configurationManager,
PageService $pageService,
SiteFinder $siteFinder
SiteFinderProxy $siteFinder
) {
$this->configurationManager = $configurationManager;
$this->pageService = $pageService;
Expand Down
10 changes: 4 additions & 6 deletions Classes/Builder/ContentTypeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ protected function addPageTsConfig(Form $form, string $contentType, string $icon

// Registration for "new content element" wizard to show our new CType
// (otherwise, only selectable via "Content type" drop-down)
ExtensionManagementUtility::addPageTSConfig(
$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'] .= PHP_EOL .
sprintf(
'mod.wizards.newContentElement.wizardItems.%s.elements.%s {
iconIdentifier = %s
Expand All @@ -316,8 +316,7 @@ protected function addPageTsConfig(Form $form, string $contentType, string $icon
$contentType,
$groupName,
$formId
)
);
);
}

protected function sanitizeString(string $string): string
Expand All @@ -339,7 +338,7 @@ protected function initializeNewContentWizardGroup(string $groupName, string $gr
return;
}

ExtensionManagementUtility::addPageTSConfig(
$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'] .= PHP_EOL .
sprintf(
'mod.wizards.newContentElement.wizardItems.%s {
%s
Expand All @@ -348,8 +347,7 @@ protected function initializeNewContentWizardGroup(string $groupName, string $gr
}',
$groupName,
'header = ' . $groupLabel
)
);
);
$groups[$groupName] = true;
}

Expand Down
2 changes: 2 additions & 0 deletions Classes/Builder/RequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public function getServerRequest(): ServerRequestInterface
$frontendTypoScript = GeneralUtility::makeInstance(
FrontendTypoScript::class,
GeneralUtility::makeInstance(RootNode::class),
[],
[],
[]
);
$frontendTypoScript->setSetupArray([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,22 @@ public function getContentTypeName(): string

public function getIconReference(): string
{
return '';
$extensionKey = ExtensionNamingUtility::getExtensionKey($this->extensionIdentity);
$contentType = $this->getContentTypeName();
$files = [
'EXT:' . $extensionKey . '/Resources/Public/Icons/Content/' . $contentType . '.svg',
'EXT:' . $extensionKey . '/Resources/Public/Icons/Content/' . $contentType . '.png',
'EXT:' . $extensionKey . '/Resources/Public/Icons/Content/' . $contentType . '.gif',
];

foreach ($files as $potentialIconFile) {
$absoluteFileName = GeneralUtility::getFileAbsFileName($potentialIconFile);
if (file_exists($absoluteFileName)) {
return $potentialIconFile;
}
}

return 'EXT:flux/Resources/Public/Icons/Extension.svg';
}

public function getExtensionIdentity(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class RecordBasedContentTypeDefinition implements FluidRenderingContentTypeDefin
public function __construct(array $record)
{
$this->record = $record;
$this->contentTypeName = $record['content_type'];
$this->contentTypeName = $record['content_type'] ?? 'undefined';
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Classes/Controller/AbstractFluxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ protected function performSubRendering(
]
)['content'];

return $content instanceof \Psr\Http\Message\ResponseInterface ? $content : $this->createHtmlResponse($content);
return $content instanceof \Psr\Http\Message\ResponseInterface || $content instanceof ResponseInterface

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.1 TYPO3 ^11.5

Class TYPO3\CMS\Extbase\Mvc\ResponseInterface not found.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.1 TYPO3 ^11.5

Method FluidTYPO3\Flux\Controller\AbstractFluxController::performSubRendering() should return Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response but returns Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response|TYPO3\CMS\Extbase\Mvc\ResponseInterface.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.3 TYPO3 ^12.4

Class TYPO3\CMS\Extbase\Mvc\ResponseInterface not found.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.3 TYPO3 ^12.4

Method FluidTYPO3\Flux\Controller\AbstractFluxController::performSubRendering() should return Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response but returns Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response|TYPO3\CMS\Extbase\Mvc\ResponseInterface.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.3 TYPO3 ^13.4

Class TYPO3\CMS\Extbase\Mvc\ResponseInterface not found.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.3 TYPO3 ^13.4

Method FluidTYPO3\Flux\Controller\AbstractFluxController::performSubRendering() should return Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response but returns Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response|TYPO3\CMS\Extbase\Mvc\ResponseInterface.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.2 TYPO3 ^11.5

Class TYPO3\CMS\Extbase\Mvc\ResponseInterface not found.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.2 TYPO3 ^11.5

Method FluidTYPO3\Flux\Controller\AbstractFluxController::performSubRendering() should return Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response but returns Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response|TYPO3\CMS\Extbase\Mvc\ResponseInterface.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.0 TYPO3 ^11.5

Class TYPO3\CMS\Extbase\Mvc\ResponseInterface not found.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.0 TYPO3 ^11.5

Method FluidTYPO3\Flux\Controller\AbstractFluxController::performSubRendering() should return Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response but returns Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response|TYPO3\CMS\Extbase\Mvc\ResponseInterface.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 7.4 TYPO3 ^10.4

Method FluidTYPO3\Flux\Controller\AbstractFluxController::performSubRendering() should return Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response but returns Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\ResponseInterface.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.2 TYPO3 ^12.4

Class TYPO3\CMS\Extbase\Mvc\ResponseInterface not found.

Check failure on line 438 in Classes/Controller/AbstractFluxController.php

View workflow job for this annotation

GitHub Actions / PHPStan, PHP 8.2 TYPO3 ^12.4

Method FluidTYPO3\Flux\Controller\AbstractFluxController::performSubRendering() should return Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response but returns Psr\Http\Message\ResponseInterface|TYPO3\CMS\Extbase\Mvc\Response|TYPO3\CMS\Extbase\Mvc\ResponseInterface.
? $content
: $this->createHtmlResponse($content);
}

protected function hasSubControllerActionOnForeignController(
Expand Down
5 changes: 3 additions & 2 deletions Classes/Form/Transformation/Transformer/FileTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use FluidTYPO3\Flux\Form\FormInterface;
use FluidTYPO3\Flux\Form\OptionCarryingInterface;
use FluidTYPO3\Flux\Form\Transformation\DataTransformerInterface;
use FluidTYPO3\Flux\Proxy\ResourceFactoryProxy;
use FluidTYPO3\Flux\Utility\DoctrineQueryProxy;
use FluidTYPO3\Flux\Utility\ExtensionConfigurationUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
Expand All @@ -30,9 +31,9 @@
class FileTransformer implements DataTransformerInterface
{
private ConnectionPool $connectionPool;
private ResourceFactory $resourceFactory;
private ResourceFactoryProxy $resourceFactory;

public function __construct(ConnectionPool $connectionPool, ResourceFactory $resourceFactory)
public function __construct(ConnectionPool $connectionPool, ResourceFactoryProxy $resourceFactory)
{
$this->connectionPool = $connectionPool;
$this->resourceFactory = $resourceFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
use FluidTYPO3\Flux\Provider\ProviderInterface;
use FluidTYPO3\Flux\Service\CacheService;
use FluidTYPO3\Flux\Utility\ExtensionNamingUtility;
use FluidTYPO3\Flux\Utility\MiscellaneousUtility;
use Symfony\Component\Finder\Finder;
use TYPO3\CMS\Core\Core\ApplicationContext;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Exception\Page\PageNotFoundException;
use TYPO3\CMS\Core\Package\PackageManager;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3Fluid\Fluid\Exception;

class SpooledConfigurationApplicator
Expand Down Expand Up @@ -54,7 +56,8 @@ public function __construct(
public function processData(): void
{
// Initialize the TCA needed by "template as CType" integrations
$this->spoolQueuedContentTypeTableConfigurations(Core::getQueuedContentTypeRegistrations());
$registrations = Core::getQueuedContentTypeRegistrations();
$this->spoolQueuedContentTypeTableConfigurations($registrations);

foreach ($this->contentTypeManager->fetchContentTypes() as $contentType) {
if (!$contentType instanceof FluidRenderingContentTypeDefinitionInterface) {
Expand Down
1 change: 0 additions & 1 deletion Classes/Integration/FormEngine/ClearValueWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class ClearValueWizard extends AbstractNode
public function render(): array
{
$result = $this->initializeResultArray();

$fieldName = 'data' . $this->data['elementBaseName'];
$nameSegments = explode('][', $fieldName);
$nameSegments[count($nameSegments) - 2] .= '_clear';
Expand Down
9 changes: 1 addition & 8 deletions Classes/Integration/FormEngine/ColumnPositionNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,12 @@

class ColumnPositionNode extends AbstractNode implements NodeInterface
{
private array $parameters = [];

public function __construct(NodeFactory $nodeFactory, array $data = [])
{
$this->parameters = $data;
}

public function render(): array
{
$return = $this->initializeResultArray();
/** @var UserFunctions $userFunctions */
$userFunctions = GeneralUtility::makeInstance(UserFunctions::class);
$return['html'] = $userFunctions->renderColumnPositionField($this->parameters);
$return['html'] = $userFunctions->renderColumnPositionField($this->data);
return $return;
}
}
9 changes: 1 addition & 8 deletions Classes/Integration/FormEngine/ContentTypeValidatorNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@

class ContentTypeValidatorNode extends AbstractNode implements NodeInterface
{
private array $parameters = [];

public function __construct(NodeFactory $nodeFactory, array $data = [])
{
$this->parameters = $data;
}

public function render(): array
{
$return = $this->initializeResultArray();
/** @var ContentTypeValidator $validator */
$validator = GeneralUtility::makeInstance(ContentTypeValidator::class);
$return['html'] = $validator->validateContentTypeRecord(
$this->parameters['parameterArray'] + ['row' => $this->parameters['databaseRow']]
$this->data['parameterArray'] + ['row' => $this->data['databaseRow']]
);
return $return;
}
Expand Down
9 changes: 1 addition & 8 deletions Classes/Integration/FormEngine/HtmlOutputNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,12 @@

class HtmlOutputNode extends AbstractNode implements NodeInterface
{
private array $parameters = [];

public function __construct(NodeFactory $nodeFactory, array $data = [])
{
$this->parameters = $data;
}

public function render(): array
{
$return = $this->initializeResultArray();
/** @var UserFunctions $userFunctions */
$userFunctions = GeneralUtility::makeInstance(UserFunctions::class);
$return['html'] = $userFunctions->renderHtmlOutputField($this->parameters['parameterArray']);
$return['html'] = $userFunctions->renderHtmlOutputField($this->data['parameterArray']);
return $return;
}
}
6 changes: 3 additions & 3 deletions Classes/Integration/FormEngine/ProviderProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
use FluidTYPO3\Flux\Content\ContentTypeManager;
use FluidTYPO3\Flux\Provider\Interfaces\DataStructureProviderInterface;
use FluidTYPO3\Flux\Provider\ProviderResolver;
use FluidTYPO3\Flux\Proxy\SiteFinderProxy;
use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class ProviderProcessor implements FormDataProviderInterface
{
private ProviderResolver $resolver;
private ContentTypeManager $contentTypeManager;
private SiteFinder $siteFinder;
private SiteFinderProxy $siteFinder;

public function __construct(
ProviderResolver $resolver,
ContentTypeManager $contentTypeManager,
SiteFinder $siteFinder
SiteFinderProxy $siteFinder
) {
$this->resolver = $resolver;
$this->contentTypeManager = $contentTypeManager;
Expand Down
9 changes: 1 addition & 8 deletions Classes/Integration/FormEngine/TemplateSourceDumperNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@

class TemplateSourceDumperNode extends AbstractNode implements NodeInterface
{
private array $parameters = [];

public function __construct(NodeFactory $nodeFactory, array $data = [])
{
$this->parameters = $data;
}

public function render(): array
{
$return = $this->initializeResultArray();
/** @var ContentTypeFluxTemplateDumper $dumper */
$dumper = GeneralUtility::makeInstance(ContentTypeFluxTemplateDumper::class);
$return['html'] = $dumper->dumpFluxTemplate(
$this->parameters['parameterArray'] + ['row' => $this->parameters['databaseRow']]
$this->data['parameterArray'] + ['row' => $this->data['databaseRow']]
);
return $return;
}
Expand Down
6 changes: 3 additions & 3 deletions Classes/Integration/HookSubscribers/ContentIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
use FluidTYPO3\Flux\Hooks\HookHandler;
use FluidTYPO3\Flux\Provider\Interfaces\GridProviderInterface;
use FluidTYPO3\Flux\Provider\ProviderResolver;
use FluidTYPO3\Flux\Proxy\IconFactoryProxy;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem;
use TYPO3\CMS\Backend\View\PageLayoutView;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList;

Expand All @@ -38,12 +38,12 @@ class ContentIcon
];

protected ProviderResolver $providerResolver;
protected IconFactory $iconFactory;
protected IconFactoryProxy $iconFactory;
protected FrontendInterface $cache;

public function __construct(
ProviderResolver $providerResolver,
IconFactory $iconFactory,
IconFactoryProxy $iconFactory,
CacheManager $cacheManager
) {
$this->providerResolver = $providerResolver;
Expand Down
10 changes: 3 additions & 7 deletions Classes/Integration/HookSubscribers/DynamicFlexForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,19 @@
*/

use FluidTYPO3\Flux\Builder\FlexFormBuilder;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
use FluidTYPO3\Flux\Proxy\FlexFormToolsProxy;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class DynamicFlexForm
{
protected FlexFormBuilder $flexFormBuilder;
protected FlexFormTools $flexFormTools;
protected FlexFormToolsProxy $flexFormTools;

protected static bool $recursed = false;

public function __construct()
public function __construct(FlexFormBuilder $flexFormBuilder, FlexFormToolsProxy $flexFormTools)
{
/** @var FlexFormBuilder $flexFormBuilder */
$flexFormBuilder = GeneralUtility::makeInstance(FlexFormBuilder::class);
$this->flexFormBuilder = $flexFormBuilder;
/** @var FlexFormTools $flexFormTools */
$flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
$this->flexFormTools = $flexFormTools;
}

Expand Down
Loading

0 comments on commit 50055a8

Please sign in to comment.