Project

General

Profile

Actions

Bug #103076

closed

No labels for values configured with TSConfig in backend preview

Added by Klaus Moser 10 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2024-02-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

Actions

Also available in: Atom PDF