As a temporary workaround, this formattedLabel_userFunc works:
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class NestedInlineFieldLabelProvider {
/**
* While a record can have a nested inline field value as label (the first child's record title
* will become the label), this functionality does not work when the record itself is shown as inline child.
* We need to use a userFunc to work around this issue. (https://forge.typo3.org/issues/78726)
*
* @param array &$parameters
*/
function nestedInlineFieldFormattedLabelUserFunc(&$parameters) {
if(!$parameters['row']) {
return;
}
$enclosingTableTCA = $GLOBALS['TCA'][$parameters['table']];
$labelField = $enclosingTableTCA['ctrl']['label'];
$labelFieldForeignTable = $enclosingTableTCA['columns'][$labelField]['config']['foreign_table'];
// Note: \TYPO3\CMS\Backend\Form\FormDataProvider\TcaInline::resolveRelatedRecords() resolves
// $result['databaseRow'][$fieldName] into a comma-separated UID list.
// Unfortunately, $result['processedTca']['columns'][$fieldName]['children'] is not available to us here.
// @see \TYPO3\CMS\Backend\Form\FormDataProvider\TcaInline::resolveRelatedRecords()
$labelFieldForeignUidCsvList = $parameters['row'][$labelField];
if(!$labelFieldForeignUidCsvList) {
return;
}
$labelFieldForeignUid = (int)current(
GeneralUtility::trimExplode(',', $labelFieldForeignUidCsvList, true)
);
if(!$labelFieldForeignUid) {
return;
}
$parameters['title'] = BackendUtility::getRecordTitle(
$labelFieldForeignTable,
BackendUtility::getRecord(
$labelFieldForeignTable,
$labelFieldForeignUid
),
true
);
}
}
Relevant ctrl definition of 'tx_ncappomfbpscan_domain_model_question':
'ctrl' => [
'label' => 'question_content',
'formattedLabel_userFunc' => 'Netcreators\NcAppoMfbpscan\TYPO3\Service\TCA\NestedInlineFieldLabelProvider->nestedInlineFieldFormattedLabelUserFunc',
...
],
--> Without the 'formattedLabel_userFunc', the label (question_content[first child record].header+bodytext) is shown in list view, but not shown when question is an inline child of the enclosing subcategory (TCA column definition: see below.)
Column definition of 'tx_ncappomfbpscan_domain_model_question'.'question_content':
'question_content' => [
'exclude' => 0,
'label' => 'LLL:EXT:nc_appo_mfbpscan/Resources/Private/Language/locallang_db.xlf:tx_ncappomfbpscan_domain_model_question.question_content',
'config' => [
'type' => 'inline',
'foreign_table' => 'tt_content',
'MM' => 'tx_ncappomfbpscan_question_content_mm',
'MM_match_fields' => [
'fieldname' => 'question_content',
],
'maxitems' => 9999,
'appearance' => [
'collapseAll' => true,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'useSortable' => 1,
'showAllLocalizationLink' => 1
],
'foreign_types' => [
'text' => [
'columnsOverrides' => [
'bodytext' => [
'defaultExtras' => 'richtext:rte_transform[mode=ts_css]',
],
],
'showitem' => 'bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext_formlabel',
],
],
],
],
Column definition of enclosing 'tx_ncappomfbpscan_domain_model_subcategory'.'questions':
'questions' => [
'exclude' => 0,
'label' => 'LLL:EXT:nc_appo_mfbpscan/Resources/Private/Language/locallang_db.xlf:tx_ncappomfbpscan_domain_model_subcategory.questions',
'config' => [
'type' => 'inline',
'foreign_table' => 'tx_ncappomfbpscan_domain_model_question',
'foreign_field' => 'subcategory',
'foreign_sortby' => 'sorting',
'maxitems' => 9999,
'appearance' => [
'collapseAll' => true,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'useSortable' => 1,
'showAllLocalizationLink' => 1
],
],
],