Project

General

Profile

Actions

Feature #82990

closed

Hidden TCA fields are rendered if used as label

Added by Tizian Schmidlin about 7 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2017-11-14
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Hello there,

there is a flaw in the way TYPO3 handle the rendering of the backend Edit Forms in TYPO3 7 (and possibly in TYPO3 8 but I did not test that there). As it turns out, if a field is used as a label, the underlying form field is always rendered.

Now this is not a problem in 99.9% of the time but it is in one place that concerns every TYPO3: editing sys_file_metadata on a system with thousands of files. What happens is, that since the label of the sys_file_metadata record is the field file, the FormDataProvider TcaColumnsProcessRecordTitle will add file to the columnsToProcess for the current record and the TcaSelectItems will happily work it's way through and generate the html for the select box. Bare in mind, that this is absolute and utter dead weight since nowhere in the TCA showItem definition of any type the file field is referenced. This would not be to big of a problem since in most systems there are no more than 10k files but in systems with 100'000+ the memory get's used up and it can lead to memory exhausted errors in PHP (even with as much as 512M memory_limit).

Would it be possible to handle this special case in some way? Maybe by adding an additional DataProvider that removes all columsn that are not needed by showItem?

Best Regards
Tizian


Related issues 1 (0 open1 closed)

Precedes TYPO3 Core - Bug #91130: TCA for field "status" in EXT:filemetatada is broken since TYPO3 v9ClosedXavier Perseguers2017-11-152017-11-15

Actions
Actions #1

Updated by Tizian Schmidlin about 7 years ago

  • Assignee set to Tizian Schmidlin

I'm currently working on a fix by removing columnsToProcess from TcaColumnsProcessRecordTitle, I'll test it and provide a patch asap.

Actions #2

Updated by Tizian Schmidlin about 7 years ago

As it appears, it's not possible to simply say "screw title fields" or anything, since everything is very intertwined :-(

What I'd like to propose is an additional configuration field for TCA to tell the TcaSelectItems data provider to not translate the labels, which should make sense, at least, for sys_file_metadata.

Actions #3

Updated by Tizian Schmidlin about 7 years ago

Patch:


--- a/typo3_src-7.6.23/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectItems.php
+++ b/typo3_src-7.6.23/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectItems.php
@@ -90,8 +90,10 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
                 $removedItems
             );

-            // Translate labels
-            $fieldConfig['config']['items'] = $this->translateLabels($result, $fieldConfig['config']['items'], $table, $fieldName);
+            if(!isset($fieldConfig['config']['doNotTranslate']) || !$fieldConfig['config']['doNotTranslate']) {
+                               // Translate labels
+                               $fieldConfig['config']['items'] = $this->translateLabels($result, $fieldConfig['config']['items'], $table, $fieldName);
+                       }

             // Keys may contain table names, so a numeric array is created
             $fieldConfig['config']['items'] = array_values($fieldConfig['config']['items']);

Actions #4

Updated by Gerrit Code Review about 5 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61970

Actions #5

Updated by Tizian Schmidlin about 5 years ago

  • Tracker changed from Bug to Feature
Actions #6

Updated by Gerrit Code Review about 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61970

Actions #7

Updated by Gerrit Code Review about 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61970

Actions #8

Updated by Gerrit Code Review about 5 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61970

Actions #9

Updated by Gerrit Code Review about 5 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61970

Actions #10

Updated by Gerrit Code Review about 5 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61970

Actions #11

Updated by Gerrit Code Review about 5 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61970

Actions #12

Updated by Gerrit Code Review about 5 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61970

Actions #13

Updated by Gerrit Code Review over 4 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61970

Actions #14

Updated by Gerrit Code Review over 4 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63742

Actions #15

Updated by Tizian Schmidlin over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #16

Updated by Xavier Perseguers over 4 years ago

  • Precedes Bug #91130: TCA for field "status" in EXT:filemetatada is broken since TYPO3 v9 added
Actions #17

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF