Review main Merged

93828[TASK] Allow translated labels in TCA "color" elements

Garvin Hicking CR +2 V +2 Hard +267 −8 updated 05/02/26, 16:55

Commit message

With the introduction of Alwan for the TCA color type,
the valuePicker items are migrated to swatches on the fly.

However, the label was only passed through as-is. This patch
adds languageService calls to resolve the labels and unifies
output to "label (#RRGGBB)" including fallback for null
or empty values.

Missing tests for the output of this element are now added,
covering the changed behavior.

Examples are added to EXT:styleguide to show that fallbacks
are also utilized. EXT:scheduler task group color swatches
actually also revealed the broken behavior.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • Josua Vogel +1
    • Jörg Bösche +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • Josua Vogel +1
    • core-ci +1 CI

Issues 2

Files 6

Review log 1923

  1. Garvin Hicking uploaded patch set 1 04/23/26, 12:44

  2. core-ci voted on patch set 1 V +1 04/23/26, 12:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101039

  3. Nikita Hovratov voted on patch set 1 CR +1 V +1 04/23/26, 13:03

  4. Josua Vogel uploaded patch set 2 CR +1 V +1 04/24/26, 07:48

  5. Josua Vogel commented on patch set 2 04/24/26, 07:48

    @garvin@hick.ing I added the following: A shared resolveColorLabel closure ensures consistent behavior: - Translatable labels (LLL:, domain syntax) are resolved via sL() - If sL() returns an empty string (e.g. invalid LLL reference), the raw color value is used as fallback instead of a broken label - null or empty labels gracefully fall back to the color value - Both palette and valuePicker labels use the same format: "Translated Label (#RRGGBB)"
  6. core-ci voted on patch set 2 V +1 04/24/26, 07:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101076

  7. Josua Vogel voted on patch set 2 CR +1 V +1 04/24/26, 08:24

  8. Benjamin Franzke voted on patch set 2 CR +1 V +1 04/24/26, 09:24

  9. Oliver Klee voted on patch set 2 CR +1 04/24/26, 11:11

  10. Garvin Hicking commented on patch set 2 04/24/26, 12:42

    Thanks - tbh I'm not the biggest fan of inline

    Reply

    I would rather like to have this as a protected method; that would allow testability, and I don't really like mixing "real" methods within methods - one reason why I prefer PHP over JavaScript ;-) Would that be fine with everyone who has voted? I do see benefit in streamling this, so thanks for the nudge.
  11. Josua Vogel commented on patch set 2 04/24/26, 12:48

    Reply

    Yes, that would be fine 😊
  12. Benjamin Franzke commented on patch set 2 04/24/26, 13:02

    Reply

    well, on the other hand one could argue: protected (better say private) methods shall not be tested at all (they are implementation detail), only public ones ;)
  13. Garvin Hicking commented on patch set 2 CR -1 04/24/26, 13:28

    on it
  14. Garvin Hicking uploaded patch set 3 CR +1 V +1 04/24/26, 14:34

  15. Garvin Hicking commented on patch set 3 04/24/26, 14:37

    Reply

    I implicitly read this as "So let's actually have a test" - so here we go 😊 The json encoded checks might be awkward, but I assumed we don't want to extract JSON out of HTML to decode it to match it to a readable array, and I think the assertions are "good enough". The only thing I see that's arguably a case, I had to add the `$this` context to the now non-static array_map enclosure. Hope that's fine for everyone like this.
  16. Garvin Hicking uploaded patch set 4 04/24/26, 14:38

  17. core-ci voted on patch set 3 V +1 04/24/26, 14:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101094

  18. core-ci voted on patch set 4 V +1 04/24/26, 14:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101095

  19. Josua Vogel voted on patch set 4 CR +1 V +1 04/24/26, 14:47

  20. Jörg Bösche voted on patch set 4 CR +1 04/28/26, 06:40

  21. Oliver Klee voted on patch set 4 CR +1 V +1 04/28/26, 10:51

  22. Christian Kuhn commented on patch set 4 CR +2 V +2 05/02/26, 15:59

    Reply

    thanks. i guess the $this context is fine in this case.
  23. Christian Kuhn merged patch set 5 05/02/26, 16:55