Skip to content

Commit 1a49ef7

Browse files
committed
[!!!][TASK] Remove ext:fluid fillDefaultsByPackageName()
Remove as advertised. Resolves: #105419 Related: #105377 Related: #104764 Releases: main Change-Id: I0e96a90f4518ff67dede7ba3392d3e884919150b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86720 Tested-by: Andreas Kienast <akienast@scripting-base.de> Reviewed-by: Garvin Hicking <gh@faktor-e.de> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Andreas Kienast <akienast@scripting-base.de> Tested-by: Garvin Hicking <gh@faktor-e.de> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
1 parent 7ee75f3 commit 1a49ef7

File tree

4 files changed

+2
-291
lines changed

4 files changed

+2
-291
lines changed

typo3/sysext/core/Documentation/Changelog/14.0/Breaking-105377-DeprecatedFunctionalityRemoved.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ The following PHP class methods that have previously been marked as deprecated w
4848
* :php:`\TYPO3\CMS\Backend\View\BackendLayout\DataProviderContext->setTableName()`
4949
- :php:`\TYPO3\CMS\Core\Authentication\BackendUserAuthentication->returnWebmounts()`
5050
- :php:`\TYPO3\CMS\Core\Imaging\Event\ModifyIconForResourcePropertiesEvent->getSize()`
51+
- :php:`\TYPO3\CMS\Fluid\View\TemplatePaths->fillDefaultsByPackageName()`
5152

5253
The following PHP static class methods that have previously been marked as deprecated for v13 have been removed:
5354

typo3/sysext/fluid/Classes/View/TemplatePaths.php

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,9 @@
1717

1818
namespace TYPO3\CMS\Fluid\View;
1919

20-
use Psr\Http\Message\ServerRequestInterface;
21-
use TYPO3\CMS\Core\Http\ApplicationType;
2220
use TYPO3\CMS\Core\Utility\ArrayUtility;
23-
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
2421
use TYPO3\CMS\Core\Utility\GeneralUtility;
2522
use TYPO3\CMS\Core\Utility\PathUtility;
26-
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
2723

2824
/**
2925
* Custom implementation for template paths resolving, one which differs from the base
@@ -34,25 +30,6 @@
3430
*/
3531
class TemplatePaths extends \TYPO3Fluid\Fluid\View\TemplatePaths
3632
{
37-
/**
38-
* Fills the path arrays with defaults, by package name.
39-
* Reads those defaults from TypoScript if possible and
40-
* if not defined, uses fallback paths by convention.
41-
*
42-
* @param string $packageName
43-
* @deprecated since TYPO3 v13, will be removed in v14. Also removed in Fluid standalone v4.
44-
*/
45-
public function fillDefaultsByPackageName($packageName): void
46-
{
47-
trigger_error(
48-
__CLASS__ . '->' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v14.'
49-
. ' Please calculate proper paths in the consuming class and use the setters'
50-
. ' to set template, partial and layout paths.',
51-
E_USER_DEPRECATED
52-
);
53-
$this->fillFromConfigurationArray($this->getContextSpecificViewConfiguration($packageName));
54-
}
55-
5633
/**
5734
* Overridden setter with enforced sorting behavior
5835
*/
@@ -99,69 +76,4 @@ protected function ensureAbsolutePath($reference): string
9976
{
10077
return PathUtility::isAbsolutePath($reference) ? $reference : GeneralUtility::getFileAbsFileName($reference);
10178
}
102-
103-
/**
104-
* @deprecated Remove in v14 along with fillDefaultsByPackageName()
105-
*/
106-
protected function getContextSpecificViewConfiguration(string $extensionKey): array
107-
{
108-
if (empty($extensionKey)) {
109-
return [];
110-
}
111-
$resources = $this->getExtensionPrivateResourcesPath($extensionKey);
112-
$paths = [
113-
self::CONFIG_TEMPLATEROOTPATHS => [$resources . 'Templates/'],
114-
self::CONFIG_PARTIALROOTPATHS => [$resources . 'Partials/'],
115-
self::CONFIG_LAYOUTROOTPATHS => [$resources . 'Layouts/'],
116-
];
117-
$configuredPaths = [];
118-
if (!empty($this->templateRootPaths) || !empty($this->partialRootPaths) || !empty($this->layoutRootPaths)) {
119-
// The view was configured already
120-
$configuredPaths = [
121-
self::CONFIG_TEMPLATEROOTPATHS => $this->templateRootPaths,
122-
self::CONFIG_PARTIALROOTPATHS => $this->partialRootPaths,
123-
self::CONFIG_LAYOUTROOTPATHS => $this->layoutRootPaths,
124-
];
125-
} else {
126-
$configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class);
127-
$typoScript = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
128-
$signature = str_replace('_', '', $extensionKey);
129-
$isBackendMode = ($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface
130-
&& ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend();
131-
$isFrontendMode = ($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface
132-
&& ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend();
133-
if ($isBackendMode && isset($typoScript['module.']['tx_' . $signature . '.']['view.'])) {
134-
$configuredPaths = (array)$typoScript['module.']['tx_' . $signature . '.']['view.'];
135-
$configuredPaths = GeneralUtility::removeDotsFromTS($configuredPaths);
136-
} elseif ($isFrontendMode && isset($typoScript['plugin.']['tx_' . $signature . '.']['view.'])) {
137-
$configuredPaths = (array)$typoScript['plugin.']['tx_' . $signature . '.']['view.'];
138-
$configuredPaths = GeneralUtility::removeDotsFromTS($configuredPaths);
139-
}
140-
}
141-
if (empty($configuredPaths)) {
142-
return $paths;
143-
}
144-
foreach ($paths as $name => $defaultPaths) {
145-
if (!empty($configuredPaths[$name])) {
146-
$configured = ArrayUtility::sortArrayWithIntegerKeys((array)$configuredPaths[$name]);
147-
// calculate implicit default paths which have not been explicitly configured
148-
$implicitDefaultPaths = array_diff($defaultPaths, $configured);
149-
// prepend implicit default paths (which have not been found in configured paths), as fallbacks
150-
$paths[$name] = array_merge($implicitDefaultPaths, $configured);
151-
}
152-
}
153-
return $paths;
154-
}
155-
156-
/**
157-
* @deprecated Remove in v14 along with fillDefaultsByPackageName()
158-
*/
159-
protected function getExtensionPrivateResourcesPath(string $extensionKey): ?string
160-
{
161-
$extensionKey = trim($extensionKey);
162-
if ($extensionKey && ExtensionManagementUtility::isLoaded($extensionKey)) {
163-
return ExtensionManagementUtility::extPath($extensionKey) . 'Resources/Private/';
164-
}
165-
return null;
166-
}
16779
}

typo3/sysext/fluid/Tests/Unit/View/TemplatePathsTest.php

Lines changed: 0 additions & 203 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,11 @@
1919

2020
use PHPUnit\Framework\Attributes\DataProvider;
2121
use PHPUnit\Framework\Attributes\Test;
22-
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder;
23-
use TYPO3\CMS\Core\Http\ServerRequest;
24-
use TYPO3\CMS\Core\Utility\GeneralUtility;
25-
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
2622
use TYPO3\CMS\Fluid\View\TemplatePaths;
2723
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
2824

2925
final class TemplatePathsTest extends UnitTestCase
3026
{
31-
protected bool $resetSingletonInstances = true;
32-
3327
public static function getPathSetterMethodTestValues(): array
3428
{
3529
$generator = static function ($method, $indexType = 'numeric') {
@@ -100,201 +94,4 @@ public function pathSetterMethodSortsPathsByKeyDescending(string $method, array
10094
$subject->$setter($paths);
10195
self::assertEquals($expected, $subject->$getter());
10296
}
103-
104-
#[Test]
105-
public function getContextSpecificViewConfigurationSortsTypoScriptConfiguredPathsCorrectlyInFrontendMode(): void
106-
{
107-
$configurationManager = $this->createMock(ConfigurationManagerInterface::class);
108-
$configurationManager->expects(self::once())->method('getConfiguration')->willReturn([
109-
'plugin.' => [
110-
'tx_test.' => [
111-
'view.' => [
112-
'templateRootPaths.' => [
113-
'30' => 'third',
114-
'10' => 'first',
115-
'20' => 'second',
116-
],
117-
'partialRootPaths.' => [
118-
'20' => '2',
119-
'30' => '3',
120-
'10' => '1',
121-
],
122-
'layoutRootPaths.' => [
123-
'130' => '3.',
124-
'10' => '1.',
125-
'120' => '2.',
126-
],
127-
],
128-
],
129-
],
130-
]);
131-
GeneralUtility::setSingletonInstance(ConfigurationManagerInterface::class, $configurationManager);
132-
$GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_FE);
133-
$subject = $this->getAccessibleMock(TemplatePaths::class, ['getExtensionPrivateResourcesPath']);
134-
$subject->expects(self::once())->method('getExtensionPrivateResourcesPath')->with('test')->willReturn('test/');
135-
$result = $subject->_call('getContextSpecificViewConfiguration', 'test');
136-
self::assertSame([
137-
'templateRootPaths' => [
138-
'test/Templates/',
139-
'first',
140-
'second',
141-
'third',
142-
],
143-
'partialRootPaths' => [
144-
'test/Partials/',
145-
'1',
146-
'2',
147-
'3',
148-
],
149-
'layoutRootPaths' => [
150-
'test/Layouts/',
151-
'1.',
152-
'2.',
153-
'3.',
154-
],
155-
], $result);
156-
}
157-
158-
#[Test]
159-
public function getContextSpecificViewConfigurationSortsTypoScriptConfiguredPathsCorrectlyInBackendMode(): void
160-
{
161-
$configurationManager = $this->createMock(ConfigurationManagerInterface::class);
162-
$configurationManager->expects(self::once())->method('getConfiguration')->willReturn([
163-
'module.' => [
164-
'tx_test.' => [
165-
'view.' => [
166-
'templateRootPaths.' => [
167-
'30' => 'third',
168-
'10' => 'first',
169-
'20' => 'second',
170-
],
171-
'partialRootPaths.' => [
172-
'20' => '2',
173-
'30' => '3',
174-
'10' => '1',
175-
],
176-
'layoutRootPaths.' => [
177-
'130' => '3.',
178-
'10' => '1.',
179-
'120' => '2.',
180-
],
181-
],
182-
],
183-
],
184-
]);
185-
GeneralUtility::setSingletonInstance(ConfigurationManagerInterface::class, $configurationManager);
186-
$GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE);
187-
$subject = $this->getAccessibleMock(TemplatePaths::class, ['getExtensionPrivateResourcesPath']);
188-
$subject->expects(self::once())->method('getExtensionPrivateResourcesPath')->with('test')->willReturn('test/');
189-
$result = $subject->_call('getContextSpecificViewConfiguration', 'test');
190-
self::assertSame([
191-
'templateRootPaths' => [
192-
'test/Templates/',
193-
'first',
194-
'second',
195-
'third',
196-
],
197-
'partialRootPaths' => [
198-
'test/Partials/',
199-
'1',
200-
'2',
201-
'3',
202-
],
203-
'layoutRootPaths' => [
204-
'test/Layouts/',
205-
'1.',
206-
'2.',
207-
'3.',
208-
],
209-
], $result);
210-
}
211-
212-
#[Test]
213-
public function getContextSpecificViewConfigurationDoesNotResolveFromTypoScriptAndDoesNotSortInUnspecifiedMode(): void
214-
{
215-
$configurationManager = $this->createMock(ConfigurationManagerInterface::class);
216-
$configurationManager->expects(self::once())->method('getConfiguration')->willReturn([
217-
'plugin.' => [
218-
'tx_test.' => [
219-
'view.' => [
220-
'templateRootPaths.' => [
221-
'30' => 'third',
222-
'10' => 'first',
223-
'20' => 'second',
224-
],
225-
'partialRootPaths.' => [
226-
'20' => '2',
227-
'30' => '3',
228-
'10' => '1',
229-
],
230-
'layoutRootPaths.' => [
231-
'130' => '3.',
232-
'10' => '1.',
233-
'120' => '2.',
234-
],
235-
],
236-
],
237-
],
238-
]);
239-
GeneralUtility::setSingletonInstance(ConfigurationManagerInterface::class, $configurationManager);
240-
$subject = $this->getAccessibleMock(TemplatePaths::class, ['getExtensionPrivateResourcesPath']);
241-
$subject->expects(self::once())->method('getExtensionPrivateResourcesPath')->with('test')->willReturn('test/');
242-
$result = $subject->_call('getContextSpecificViewConfiguration', 'test');
243-
self::assertSame([
244-
'templateRootPaths' => [
245-
'test/Templates/',
246-
],
247-
'partialRootPaths' => [
248-
'test/Partials/',
249-
],
250-
'layoutRootPaths' => [
251-
'test/Layouts/',
252-
],
253-
], $result);
254-
}
255-
256-
#[Test]
257-
public function getContextSpecificViewConfigurationRespectsTypoScriptConfiguredPaths(): void
258-
{
259-
$configurationManager = $this->createMock(ConfigurationManagerInterface::class);
260-
$configurationManager->expects(self::once())->method('getConfiguration')->willReturn([
261-
'plugin.' => [
262-
'tx_test.' => [
263-
'view.' => [
264-
'templateRootPaths.' => [
265-
'0' => 'base/Templates/',
266-
'10' => 'test/Templates/',
267-
],
268-
'partialRootPaths.' => [
269-
'0' => 'base/Partials/',
270-
'10' => 'test/Partials/',
271-
],
272-
'layoutRootPaths.' => [
273-
'0' => 'base/Layouts/',
274-
'10' => 'test/Layouts/',
275-
],
276-
],
277-
],
278-
],
279-
]);
280-
GeneralUtility::setSingletonInstance(ConfigurationManagerInterface::class, $configurationManager);
281-
$GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_FE);
282-
$subject = $this->getAccessibleMock(TemplatePaths::class, ['getExtensionPrivateResourcesPath']);
283-
$subject->expects(self::once())->method('getExtensionPrivateResourcesPath')->with('test')->willReturn('test/');
284-
$result = $subject->_call('getContextSpecificViewConfiguration', 'test');
285-
self::assertSame([
286-
'templateRootPaths' => [
287-
'base/Templates/',
288-
'test/Templates/',
289-
],
290-
'partialRootPaths' => [
291-
'base/Partials/',
292-
'test/Partials/',
293-
],
294-
'layoutRootPaths' => [
295-
'base/Layouts/',
296-
'test/Layouts/',
297-
],
298-
], $result);
299-
}
30097
}

typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6361,6 +6361,7 @@
63616361
'maximumNumberOfArguments' => 1,
63626362
'restFiles' => [
63636363
'Deprecation-104764-FluidTemplatePaths-fillDefaultsByPackageName.rst',
6364+
'Breaking-105377-DeprecatedFunctionalityRemoved.rst',
63646365
],
63656366
],
63666367
'TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->addCacheTags' => [

0 commit comments

Comments
 (0)