Bug #77738
closedStandard language value not saved for language selection field
0%
Description
After upgrading our instances to 7.6.10, we discovered that the language value for the standard language (sys_language_uid = 0) is not saved in the DB.
We built a custom language selection field that is rendered as checkboxes in BE with the following TCA:
'allowed_languages' => array( 'label' => 'LLL:EXT:sfpdownloadcenter/Resources/Private/Language/locallang_db.xlf:tca.field.allowed_languages', 'l10n_mode' => 'exclude', 'config' => array( 'type' => 'select', 'special' => 'languages', 'maxitems' => 1000, 'renderMode' => 'checkbox' ) ),
All languages != sys_language_uid = 0 are saved properly in the DB.
See attached screenshots for further explanation.
The field is added to the table sys_file_metadata and defined as follows:
allowed_languages varchar(255) DEFAULT '' NOT NULL
Actually it should save all the checked boxes but it just skips the one for the standard language.
Files
Updated by Dmitry Dulepov about 8 years ago
- Is Regression changed from No to Yes
Hunk 1 here is responsible for the trouble. It verifies that submitted languages exist in sys_language table. Obviously value with id 0 is not there. So it is not allowed.
This is a regression.
Updated by Wouter Wolters about 8 years ago
- Status changed from New to Closed
This one is solved already with https://forge.typo3.org/issues/75998 and will be part of the next release.
Thanks for reporting it though.
Updated by Dmitry Dulepov about 8 years ago
Just a side note. The fix there is not very clean... Relation handler should not know about such things because it should focus on true relations. The fix should be in the DataHandler instead:
--- typo3/sysext/core/Classes/DataHandling/DataHandler.php 2016-09-01 15:42:51.079168920 +0200 +++ typo3/sysext/core/Classes/DataHandling/DataHandler.php 2016-09-01 16:44:38.000000000 +0200 @@ -2130,7 +2130,14 @@ ); $unsetResult = true; } else { + $reInsertZeroLanguage = false; + if (isset($tcaFieldConf['special']) && $tcaFieldConf['special'] === 'languages' && in_array('0', $valueArray)) { + $reInsertZeroLanguage = true; + } $valueArray = $this->checkValue_group_select_processDBdata($valueArray, $tcaFieldConf, $id, $status, 'select', $table, $field); + if ($reInsertZeroLanguage) { + array_unshift($valueArray, '0'); + } } } if (!$unsetResult) {
But since it is already done, let it be...