Review main Merged

90849[BUGFIX] Allow Fluid access to SiteLanguage configuration

Garvin Hicking CR +2 V +2 Normal +126 −0 updated 10/09/25, 08:05

Commit message

Accessing the `configuration` property of a `SiteLanguage`
object in Fluid was not straight-forward, because its
member properties are protected, and the `toArray()`
method is not accessible to Fluid to resolve the array
structure.

Similar to `Site`, the `SiteLanguage` object
can now access all configuration via a getter.

This allows to also access any configured custom
fields there with notation like:

```
Language: {siteLanguage.configuration.navigationTitle}
Customfield: {siteLanguage.configuration.customField}
```

(The `{siteLanguage}` variable would for example be
fetched with the SiteLanguageProcessor Dataprocessor,
or could also be retrieved from the SiteProcessor
in its sub-structure.)

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Georg Ringer +1
    • Garvin Hicking +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Georg Ringer +1
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 7

Review log 2125

  1. Garvin Hicking uploaded patch set 1 09/30/25, 20:32

  2. core-ci voted on patch set 1 V +1 09/30/25, 20:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85759

  3. Simon Schaufelberger voted on patch set 1 CR +1 V +1 10/01/25, 10:00

  4. Stefan Bürk commented on patch set 1 10/01/25, 10:01

    TBH not tested, but from reading the code in SiteLanguage, the syntax here retrieves the array and than operates on the array, making the additional lookup in the get/has code obsolete ... and providing "duplicated" access now: ``` SiteLanguage complete configuration: {siteLanguage.configuration} NavigationTitle on configuration array: {siteLanguage.configuration.navigationTitle} NavigationTitle direct: {siteLanguage.navigationTitle} ``` Or should we only allow the "transient" mapped access and not having `configuration` as special handled key to retrieve the configuration, or only that access not doing the "direct" mapping again ?

    SiteLanguage.php:194

    See comment o commit message ... does it really make sense to allow direct mapping and duplicated access on the `configuration` array ?

    SiteLanguage.php:203

    ```suggestion return array_key_exists($id, $activeConfiguration); ``` This allows access to merged raw configuration along with merged properts provided by `toArray()` and using `isset()` here would return false in case the identifier is set in the array but the value is false, which is semantically something else than not having that key/identifier set. We do not now which custom configuration is provided and handling an existing key with null value as `not has / false` is something I would not expect. Maybe switching to `array_key_exists()` here ? See also following example (https://3v4l.org/67AdD): ``` $array = [ 'id' => null, ]; var_dump(isset($array['id'])); // false var_dump(array_key_exists('id', $array)); // true ```
  5. Stefan Bürk voted on patch set 1 CR -1 10/01/25, 10:01

  6. Garvin Hicking commented on patch set 1 10/01/25, 10:11

    I think I'll have to retract from this, I'm not deep enough into it and just wanted to have a first "offer" to fix the reported bug. Happy for anyone to pick up.
  7. Soren Malling commented on patch set 1 10/07/25, 12:39

    @garvin@hick.ing It should be enough to introduce a `public function getConfiguration(): array` similar to the `Site` object itself. It will allow for accessing it in the view like `siteLanguage.configuration.whateverCustomKey`. That's the original issue that me and Robert was facing when helping him in Slack originally
  8. Garvin Hicking commented on patch set 1 10/07/25, 12:54

    Reply

    yeah I tried the interface to align with Sitelanguage and others. If you want you can rework / edit this patch, I won't find time for this soon.

    SiteLanguage.php:203 Reply

    Fix applied.
  9. Garvin Hicking marked it work in progress 10/07/25, 12:54

  10. Soren Malling uploaded patch set 2 CR +1 V +1 10/07/25, 13:15

  11. Garvin Hicking commented on patch set 2 10/07/25, 13:20

    This change is ready for review.

    SiteLanguage.php:183

    does this contain everything that "toArray" offers?
  12. core-ci voted on patch set 2 V -1 10/07/25, 13:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86159

  13. Soren Malling uploaded patch set 3 V -1 10/07/25, 13:27

  14. core-ci voted on patch set 3 V +1 10/07/25, 13:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86165

  15. Soren Malling commented on patch set 3 10/08/25, 11:04

    SiteLanguage.php:183 Reply

    No, it leaves the properties $this->languageId = $languageId; $this->locale = new Locale($locale); $this->base = $base; in the root of the {siteLanguage} object and gives you the {siteLanguage.configuration} array. This to stay as close to the Site object as possible. But I'm open for returning `toArray()` 👌
  16. Garvin Hicking commented on patch set 3 10/08/25, 12:22

    SiteLanguage.php:183 Reply

    My expectation would probably be to have the same return as in an `array()` cast in PHP, I think that could be more helpful to manage the existing keys? (That was my initial intention of the first patchset, to make this 'toArray()' structure available)
  17. Soren Malling commented on patch set 3 10/08/25, 12:56

    SiteLanguage.php:183 Reply

    All cool by me - want me to adjust it to `return $this->toArray();` ?
  18. Garvin Hicking commented on patch set 4 V +1 10/08/25, 13:23

    Published edit on patch set 3.
  19. Garvin Hicking commented on patch set 4 CR +1 V +1 10/08/25, 13:25

    Voting on Sorens rework/approach - though my vote only counts as a "normal person" vote and not a merger vote of course, so we still need one merger and anyone else.

    Reply

    We went the easier route now to propagate the info (see later comments), I'm resolving this now.

    SiteLanguage.php:183 Reply

    Just adjusted this. For me this looks good enough to vote on. Thank you!

    SiteLanguage.php:194 Reply

    Done
  20. Garvin Hicking commented on patch set 4 10/08/25, 13:25

    Reply

    Done

    Reply

    Done
  21. core-ci voted on patch set 4 V +1 10/08/25, 13:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86232

  22. Georg Ringer voted on patch set 4 CR +1 V +1 10/08/25, 14:39

  23. Stefan Bürk commented on patch set 4 CR -1 10/08/25, 18:04

    Reviewing ...
  24. Stefan Bürk commented on patch set 4 CR +2 V +2 10/09/25, 07:49

    Reply

    Done
  25. Stefan Bürk merged patch set 5 10/09/25, 08:05