Commit 66e99e14 authored by Benni Mack's avatar Benni Mack Committed by Anja Leichsenring
Browse files

[!!!][TASK] TCA: Remove "parentPageTca" FormDataProvider

The property "vanillaParentPageTca " inside FormEngine
is never used - also documented that it was never used before.

The property is therefore removed.

Resolves: #88669
Releases: master
Change-Id: I71166ea44764d8bdc4b0c309a43f45f46309780f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61207

Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Björn Jacob's avatarBjörn Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 055693b1
......@@ -182,8 +182,6 @@ class FormDataCompiler
// of handled record was determined, record type specific settings [TCEFORM.][tableName.][field.][types.][type.]
// are merged into [TCEFORM.][tableName.][field.]. Array keys still contain the concatenation dots.
'pageTsConfig' => [],
// Not changed TCA of parent page row if record is edited or added below a page and not root node
'vanillaParentPageTca' => null,
// List of available system languages. Array key is the system language uid, value array
// contains details of the record, with iso code resolved. Key is the sys_language_uid uid.
'systemLanguageRows' => [],
......
<?php
namespace TYPO3\CMS\Backend\Form\FormDataProvider;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
/**
* Add vanilla TCA of parent page
*
* @todo: maybe not needed?
*/
class ParentPageTca implements FormDataProviderInterface
{
/**
* vanillaParentPageTca will stay NULL if record is added or edited below root node.
*
* @param array $result
* @return array
*/
public function addData(array $result)
{
if (is_array($result['parentPageRow'])) {
$result['vanillaParentPageTca'] = $GLOBALS['TCA']['pages'];
}
return $result;
}
}
<?php
namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Form\FormDataProvider\ParentPageTca;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/**
* Test case
*/
class ParentPageTcaTest extends UnitTestCase
{
/**
* @var ParentPageTca
*/
protected $subject;
protected function setUp(): void
{
parent::setUp();
$this->subject = new ParentPageTca();
}
/**
* @test
*/
public function addDataSetsTableTcaFromGlobalsPagesTcaInResult()
{
$input = [
'tableName' => 'aTable',
'parentPageRow' => [],
];
$expected = ['foo'];
$GLOBALS['TCA']['pages'] = $expected;
$result = $this->subject->addData($input);
$this->assertEquals($expected, $result['vanillaParentPageTca']);
}
}
......@@ -380,18 +380,13 @@ return [
\TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfig::class,
],
],
\TYPO3\CMS\Backend\Form\FormDataProvider\ParentPageTca::class => [
'depends' => [
\TYPO3\CMS\Backend\Form\FormDataProvider\InlineOverrideChildTca::class
],
],
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowInitializeNew::class => [
'depends' => [
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseUserPermissionCheck::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\UserTsConfig::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfig::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\InitializeProcessedTca::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\ParentPageTca::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\InlineOverrideChildTca::class,
],
],
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseUniqueUidNewRow::class => [
......@@ -634,17 +629,11 @@ return [
\TYPO3\CMS\Backend\Form\FormDataProvider\UserTsConfig::class
],
],
\TYPO3\CMS\Backend\Form\FormDataProvider\ParentPageTca::class => [
'depends' => [
\TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfig::class,
],
],
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowInitializeNew::class => [
'depends' => [
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseUserPermissionCheck::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\UserTsConfig::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfig::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\ParentPageTca::class,
],
],
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseUniqueUidNewRow::class => [
......@@ -885,18 +874,13 @@ return [
\TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfig::class,
],
],
\TYPO3\CMS\Backend\Form\FormDataProvider\ParentPageTca::class => [
'depends' => [
\TYPO3\CMS\Backend\Form\FormDataProvider\InlineOverrideChildTca::class
],
],
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowInitializeNew::class => [
'depends' => [
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseUserPermissionCheck::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\UserTsConfig::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfig::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\InitializeProcessedTca::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\ParentPageTca::class,
\TYPO3\CMS\Backend\Form\FormDataProvider\InlineOverrideChildTca::class,
],
],
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseUniqueUidNewRow::class => [
......
.. include:: ../../Includes.txt
======================================================================
Breaking: #88669 - FormEngine FormDataProvider "parentPageTca" removed
======================================================================
See :issue:`88669`
Description
===========
FormEngine added "parentPageTca" by default to the result object. It was added in TYPO3 v7 during
refactoring, but already commented that it wasn't used at all in Core, and might not be necessary.
It contained a copy of :php:`$GLOBALS['TCA']['pages']`, which can be obtained directly as well.
The DataProvider and the value within the result key has been removed.
Impact
======
When accessing the `parentPageTca` key within a FormDataProvider or Node (FormEngine-related only),
a PHP notice is given due to a non-existing array key.
Affected Installations
======================
TYPO3 installations with custom FormDataProviders for FormEngine relying on the "parentPageTca"
DataProvider, which is highly unlikely.
Migration
=========
Instead of accessing `$result['parentPageTca'] within a custom FormDataProvider or FormRenderNode,
:php:`$GLOBALS['TCA']['pages']` can be accessed directly.
.. index:: TCA, NotScanned
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment