Review main Merged

89280[BUGFIX] Respect placeholder configuration in RTE fields

Cyril Janody CR +2 V +2 Normal +219 −8 updated 06/30/25, 19:13

Commit message

This change streamlines the existing TCA placeholder handling
of type=text to also work for RTE fields (that means when
`enableRichtext` is set), to align with existing input and text
field handling.

It is configured like regular input/text field TCA
(see EXT:styleguide RTE field 'rte_6'):

```
// ...
  'rteColumn' => [
    'label' => 'Some RTE field',
    'config' => [
      'type' => 'text',
      'enableRichtext' => true,
      'default' => null,
      'nullable' => true,
      'mode' => 'useOrOverridePlaceholder',
      'placeholder' => 'Insert contact details here.',
    ],
  ],
// ...
```

Inherited HTML for the placeholder (IRRE) is evaluated as proper
markup within the RTE. Labels only show the "strip_tags()"
variant of possible HTML context.

The logic for displaying placeholders and "defaults" is a bit
unfortunate, because what the UI shows as "Default" is not really
a default, but instead an inherited fallback for a decoupled
rendering process that acts on NULL values.

We should have three terms:

* Placeholder = Something the editor reads and knows what
  to fill in ("Enter file description")
* Default = A value that is actually saved ("NULL" to trigger
  fallback for example, and otherwise the actual string content)
* Fallback = A value that will be used in case the stored value
  is set to NULL

This is something that is to be streamlined across all TextElements.

The patch is meant to make RTE functionality available so that
for example `sys_file_reference` fields can be remapped to
utilize richttext editing and still keep their placeholder/fallback
functionality in place.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Benjamin Franzke +1
    • Cyril Janody +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Benjamin Franzke +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 3854

Show 1929 earlier messages
  1. Cyril Janody uploaded patch set 1 04/29/25, 13:15

  2. core-ci voted on patch set 1 V +1 04/29/25, 13:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78352

  3. Cyril Janody uploaded patch set 2 V +1 04/30/25, 18:12

  4. core-ci voted on patch set 2 V -1 04/30/25, 18:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78407

  5. Cyril Janody uploaded patch set 3 04/30/25, 18:27

    Copied Votes: * Verified-1 (copy condition: "**changekind:NO_CHANGE**")
  6. core-ci voted on patch set 3 V -1 04/30/25, 18:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78408

  7. Cyril Janody uploaded patch set 4 V -1 04/30/25, 19:30

  8. core-ci voted on patch set 4 V +1 04/30/25, 19:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78409

  9. Cyril Janody rebased onto patch set 5 V +1 05/01/25, 18:20

  10. core-ci voted on patch set 5 V +1 05/01/25, 18:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78425

  11. Cyril Janody uploaded patch set 6 V +1 05/01/25, 18:32

  12. core-ci voted on patch set 6 V +1 05/01/25, 18:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78426

  13. Juliane Wundermann commented on patch set 6 V +1 05/05/25, 21:07

    verified the feature in backend, worked as described
  14. André Buchmann uploaded patch set 7 V +1 05/08/25, 14:36

  15. André Buchmann commented on patch set 7 CR +1 V +1 05/08/25, 14:38

    Changed to feature and extended the styleguide example
  16. core-ci voted on patch set 7 V +1 05/08/25, 14:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78668

  17. Garvin Hicking commented on patch set 7 05/08/25, 15:47

    Reply

    if we label it as a feature we'll need an accompanying ReST feature file. (I do think we could argue this to be a task and apply to v13, too)
  18. André Buchmann updated the commit message in patch set 8 CR +1 V +1 05/08/25, 19:34

  19. André Buchmann commented on patch set 8 05/08/25, 19:38

    Reply

    Let's keep it small and simple and stay with task if you think this can be applied to 13.4 too.
  20. core-ci voted on patch set 8 V +1 05/08/25, 19:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78669

  21. André Buchmann voted on patch set 8 CR +1 V +1 05/08/25, 19:44

  22. Garvin Hicking commented on patch set 8 05/29/25, 14:56

    Reply

    Yes I think that's fair. Will try to finally have a look next week. Since this aligns the handling with other FormEngine Elements I think "Task" applies.
  23. Garvin Hicking uploaded patch set 9 CR +1 V +1 05/30/25, 07:45

    Some code comments removal of array redundancy
  24. core-ci voted on patch set 9 V +1 05/30/25, 07:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79686

  25. Garvin Hicking commented on patch set 9 CR +1 V +1 05/30/25, 08:08

    I think this works quite well. I made some minor adjustments: - Define `$textareaAttributesArray` globally and just change the array, so there's less redundancy and chance for errors if the main array gets changed at some point - Add some inline code comments pointing out the difference in the two 'placeholder' array entries - Add a note about why strip_tags() is applied to the placeholder - Add a trim((string)) wrap around the placeholder to align with the regular input/text code If you agree, for me this one is ready to go - thanks for your contribution! :)
  26. Cyril Janody commented on patch set 9 CR +1 V +1 05/30/25, 14:58

    Reply

    Much better like this 😊
  27. Garvin Hicking commented on patch set 10 CR +1 V +1 05/30/25, 18:11

    Published edit on patch set 9.
  28. Garvin Hicking commented on patch set 10 CR +1 V +1 05/30/25, 18:14

    Changed the naming of the array structure to not have "Array" in its name, since we don't have "integer" or "string" in variable names and it wasn't a good idea of mine to name it like that. (The legacy variable names $resultArray and $parameterArray I've left untouched)
  29. core-ci voted on patch set 10 V +1 05/30/25, 18:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79702

  1. Cyril Janody voted on patch set 10 CR +1 05/30/25, 18:56

  2. Cyril Janody voted on patch set 10 V +1 05/30/25, 18:57

  3. Benjamin Franzke commented on patch set 10 06/03/25, 06:20

    Why do we add `<p>` tags in this example, if we strip (which we should change to encode) HTML before passing the placeholder to CKEditor anyway? We shouldn't support HTML in that case, right?

    RichTextElement.php:309

    Why do we allow HTML if we do strip_tags anyway? Let's just stick to plaintext and always apply proper htmlspecialchars… I mean, it is to easy to "forget" to encode the placeholder properly and we actually don't want plain HTML in TCA.
  4. Garvin Hicking commented on patch set 10 06/03/25, 06:54

    Reply

    The placeholder html is only stripped when CKeditor displays it as a placeholder ("edit-mode"). In case it displays it as readonly, it will show the formatted HTML properly. Only then for the nullable variant you would easily store exactly that formatted content. When editing the content you are overwriting the placeholder anyways (nit editing it), so IMO this would be helpful. Witbout being able to use HTML as a nullable default, the whole patch would be moot IMO.

    RichTextElement.php:309 Reply

    see above
  5. Garvin Hicking uploaded patch set 11 CR +1 V +1 06/24/25, 13:30

  6. core-ci voted on patch set 11 V +1 06/24/25, 13:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80729

  7. Garvin Hicking uploaded patch set 12 V +1 06/24/25, 16:02

  8. core-ci voted on patch set 12 V -1 06/24/25, 16:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80770

  9. Garvin Hicking commented on patch set 13 V -1 06/24/25, 18:07

    Published edit on patch set 12.
  10. core-ci voted on patch set 13 V -1 06/24/25, 18:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80782

  11. Garvin Hicking commented on patch set 13 06/24/25, 18:25

    (Note, the CI failure is because of the temporary sys_file_metadata TCA changes. Don't mind this, it will be removed)
  12. Benjamin Franzke uploaded patch set 14 V -1 06/26/25, 07:29

  13. Benjamin Franzke commented on patch set 14 06/26/25, 07:29

    Reply

    Done

    Reply

    Done

    RichTextElement.php:309 Reply

    Done
  14. core-ci voted on patch set 14 V -1 06/26/25, 07:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80946

  15. Benjamin Franzke uploaded patch set 15 CR +1 V +1 06/26/25, 08:20

  16. Benjamin Franzke updated the commit message in patch set 16 06/26/25, 08:21

  17. Benjamin Franzke voted on patch set 16 CR +1 V +1 06/26/25, 08:35

  18. Benjamin Franzke updated the commit message in patch set 17 CR +1 V +1 06/26/25, 08:37

  19. Benjamin Franzke voted on patch set 17 CR +1 V +1 06/26/25, 08:37

  20. Garvin Hicking commented on patch set 17 CR +1 V +1 06/26/25, 08:37

    What a ride 😊
  21. core-ci voted on patch set 16 V +1 06/26/25, 08:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80960

  22. core-ci voted on patch set 17 V +1 06/26/25, 08:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80965

  23. Cyril Janody commented on patch set 17 CR +1 06/30/25, 18:43

    Looks good to me 😊
  24. Garvin Hicking voted on patch set 17 CR +2 V +2 06/30/25, 18:57

  25. Garvin Hicking merged patch set 18 06/30/25, 19:13