Deprecation: #109519 - BackendUtility item list label methods 

See forge#109519

Description 

The following methods in \TYPO3\CMS\Backend\Utility\BackendUtility have been deprecated:

  • getLabelFromItemlist()
  • getLabelFromItemListMerged()
  • getLabelsFromItemsList()

Their logic has been moved to the new \TYPO3\CMS\Core\Schema\SchemaLabelResolver class, which provides proper dependency injection support.

Impact 

Calling these methods will trigger a PHP E_USER_DEPRECATED error. The methods will be removed in TYPO3 v15.0.

Affected installations 

TYPO3 installations with extensions that call BackendUtility::getLabelFromItemlist(), BackendUtility::getLabelFromItemListMerged() or BackendUtility::getLabelsFromItemsList().

Migration 

Replace calls to \TYPO3\CMS\Backend\Utility\BackendUtility::getLabelFromItemlist() with \TYPO3\CMS\Core\Schema\SchemaLabelResolver->getLabelForFieldValue().

Before:

use TYPO3\CMS\Backend\Utility\BackendUtility;

$label = BackendUtility::getLabelFromItemlist(
    $table, $column, $value, $row
);
Copied!

After:

use TYPO3\CMS\Core\Schema\SchemaLabelResolver;

$label = $this->schemaLabelResolver->getLabelForFieldValue(
    $table, $column, $value, $row
);
Copied!

Replace calls to \TYPO3\CMS\Backend\Utility\BackendUtility::getLabelFromItemListMerged() with \TYPO3\CMS\Core\Schema\SchemaLabelResolver->getLabelForFieldValue().

Before:

use TYPO3\CMS\Backend\Utility\BackendUtility;

$label = BackendUtility::getLabelFromItemListMerged(
    $pageId, $table, $column, $value, $row
);
Copied!

After:

use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Schema\SchemaLabelResolver;

$columnTsConfig = BackendUtility::getPagesTSconfig($pageId)
    ['TCEFORM.'][$table . '.'][$column . '.'] ?? [];
$label = $this->schemaLabelResolver->getLabelForFieldValue(
    $table, $column, $value, $row, $columnTsConfig
);
Copied!

Replace calls to BackendUtility::getLabelsFromItemsList() with \TYPO3\CMS\Core\Schema\SchemaLabelResolver->getLabelsForFieldValues(). Note that the new method returns an array of raw labels instead of a comma-separated translated string — callers must handle translation and joining themselves.

Before:

use TYPO3\CMS\Backend\Utility\BackendUtility;

$labels = BackendUtility::getLabelsFromItemsList(
    $table, $column, $keyList, $columnTsConfig, $row
);
Copied!

After:

use TYPO3\CMS\Core\Schema\SchemaLabelResolver;

$labels = $this->schemaLabelResolver->getLabelsForFieldValues(
    $table, $column, $keyList, $row, $columnTsConfig
);
$translatedLabels = implode(
    ', ',
    array_map($languageService->sL(...), $labels)
);
Copied!