Issue Bug Closed

#78344Missing use case for overriding language labels with TS and Extbase

Online Now! GmbH 10/19/16, 14:10 updated 03/08/20, 22:56

Description

I noticed a TypoScript use case not covered by the LocalizationUtility while overriding language labels with TS. It occured with the extension sr_feuser_register, but i think it is more of a extbase problem. In that extension some labels are defined like this:

fe_users.status = Label
fe_users.status.I.0 = Option 1
fe_users.status.I.1 = Option 2

The TypoScriptService Class puts the value of fe_users.status with the key _typoScriptNodeValue in the parsed array. This is not considered in the function LocalizationUtility::flattenTypoScriptLabelArray. The result of this is that the label for fe_users.status is dropped. The lables fe_users.status.I.0 and fe_users.status.I.1 are added though.

This case is also not covered by the unit tests.

I fixed the problem by adding the following to the LocalizationUtility::flattenTypoScriptLabelArray function:

if (is_array($labelValue)) {
    if(isset($labelValue['_typoScriptNodeValue'])) {
        $result[$key] = $labelValue['_typoScriptNodeValue'];
        unset($labelValue['_typoScriptNodeValue']);
    }
    $labelValue = self::flattenTypoScriptLabelArray($labelValue, $key);
    $result = array_merge($result, $labelValue);
} else {
    $result[$key] = $labelValue;
}

A similar code can be found in the TypoScriptService::convertPlainArrayToTypoScriptArray function.

The problem occured in TYPO 7.6.11, but i think it affects all versions up until 8 ( master ).

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.