Issue Bug Closed

#103076No labels for values configured with TSConfig in backend preview

Klaus Moser 02/07/24, 14:22 updated 07/09/24, 15:33

Description

Description

Backend preview shows values instead of their labels if configured via TSConfig

Example

Added some items to the tt_content fields space_before_class and space_after_class in Typo3 12.4.10 with TSConfig like this:

TCEFORM.tt_content {
  space_before_class {
    removeItems = extra-small,small,medium,large,extra-large
    addItems {
      pt-0 = No space
    }
  }
  space_after_class {
    removeItems = extra-small,dbgsmall,medium,large,extra-large
    addItems {
      pb-0 = No space
    }
  }
}

If I select a custom value for theese fields the preview shows the values instead of their labels.

Abstand davor pt-0
Abstand danach pb-0 

The problem is caused by the method getProcessedValue() in TYPO3\CMS\Backend\Preview\StandardContentPreviewRenderer. In this method BackendUtility::getProcessedValue() is called without the $pid parameter. Therefore the TSConfig will not be loaded and the addItems part with the labels in it will not be available.

Adding record['pid'] to the call solves the problem, but i’m not sure if this might cause other problems.

$fieldValue = BackendUtility::getProcessedValue('tt_content', $field, $record[$field], 0, false, false, $record['uid'] ?? 0, true, $record['pid'] ?? 0) ?? '';

Maybe some of you Typo3 Gurus can have a look at it.

Reviews 2

History 24

  1. Gerrit Code Review pushed patch set 1 for main to change 83008 status New Under Review 02/15/24, 09:55

  2. Gerrit Code Review pushed patch set 1 for 12.4 to change 82978 02/16/24, 12:41

  3. Oliver Bartsch commented and changed status Under Review Resolved done 0 % 100 % 02/16/24, 12:45

    Applied in changeset commit:4d1095fc45f2c614919be43c563d5a00980de94b.

  4. Benni Mack changed status Resolved Closed 07/09/24, 15:33