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.
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
- 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.
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.
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']);
- Status changed from New to Under Review
- Tracker changed from Bug to Feature
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Precedes Bug #91130: TCA for field "status" in EXT:filemetatada is broken since TYPO3 v9 added
- Status changed from Resolved to Closed
Also available in: Atom
PDF