protected function resolveRelatedValue(
        array $relatedRecord,
        $foreignTableTca,
        $foreignTableLabelField,
        ContentObjectRenderer $parentContentObject,
        $foreignTableName = ''
    ) {
        if ($GLOBALS['TSFE']->sys_language_uid > 0 && !empty($foreignTableName)) {
            $relatedRecord = $this->frontendOverlayService->getOverlay($foreignTableName, $relatedRecord);
        }

        $value = $relatedRecord[$foreignTableLabelField];

        if (
            !empty($foreignTableName)
            && isset($foreignTableTca['columns'][$foreignTableLabelField]['config']['foreign_table'])
            && $this->configuration['enableRecursiveValueResolution']
        ) {
            // backup
            $backupRecord = $parentContentObject->data;
            $backupConfiguration = $this->configuration;

            // adjust configuration for next level
            $this->configuration['localField'] = $foreignTableLabelField;
            $parentContentObject->data = $relatedRecord;
            if (strpos($this->configuration['foreignLabelField'], '.') !== false) {
                list(, $this->configuration['foreignLabelField']) = explode('.',
                    $this->configuration['foreignLabelField'], 2);
            } else {
                $this->configuration['foreignLabelField'] = '';
            }

            // recursion
            $relatedItemsFromForeignTable = $this->getRelatedItemsFromForeignTable(
                $foreignTableName,
                $relatedRecord['uid'],
                $foreignTableTca['columns'][$foreignTableLabelField],
                $parentContentObject
            );
            $value = array_pop($relatedItemsFromForeignTable);

            // restore
            $this->configuration = $backupConfiguration;
            $parentContentObject->data = $backupRecord;
        }

        return $parentContentObject->stdWrap($value, $this->configuration);
    }
protected function resolveRelatedValue(
        array $relatedRecord,
        $foreignTableTca,
        $foreignTableLabelField,
        ContentObjectRenderer $parentContentObject,
        $foreignTableName = ''
    ) {
        if ($GLOBALS['TSFE']->sys_language_uid > 0 && !empty($foreignTableName)) {
            $relatedRecord = $this->frontendOverlayService->getOverlay($foreignTableName, $relatedRecord);
        }

        $value = $relatedRecord[$foreignTableLabelField];

        if (
            !empty($foreignTableName)
            && isset($foreignTableTca['columns'][$foreignTableLabelField]['config']['foreign_table'])
            && $this->configuration['enableRecursiveValueResolution']
        ) {
            // backup
            $backupRecord = $parentContentObject->data;
            $backupConfiguration = $this->configuration;

            // adjust configuration for next level
            $this->configuration['localField'] = $foreignTableLabelField;
            $parentContentObject->data = $relatedRecord;
            if (strpos($this->configuration['foreignLabelField'], '.') !== false) {
                list(, $this->configuration['foreignLabelField']) = explode('.',
                    $this->configuration['foreignLabelField'], 2);
            } else {
                $this->configuration['foreignLabelField'] = '';
            }

            // recursion
            $relatedItemsFromForeignTable = $this->getRelatedItemsFromForeignTable(
                $foreignTableName,
                $relatedRecord['uid'],
                $foreignTableTca['columns'][$foreignTableLabelField],
                $parentContentObject
            );
            $value = array_pop($relatedItemsFromForeignTable);

            // restore
            $this->configuration = $backupConfiguration;
            $parentContentObject->data = $backupRecord;
        }

        return $parentContentObject->stdWrap($value, $this->configuration);
    }
protected function resolveRelatedValue ( array $ relatedRecord , $ foreignTableTca , $ foreignTableLabelField , ContentObjectRenderer $ parentContentObject , $ foreignTableName = '' ) { if ( $ GLOBALS [ 'TSFE' ] -> sys_language_uid > 0 && ! empty ( $ foreignTableName ) ) { $ relatedRecord = $ this -> frontendOverlayService -> getOverlay ( $ foreignTableName , $ relatedRecord ) ; } $ value = $ relatedRecord [ $ foreignTableLabelField ] ; if ( ! empty ( $ foreignTableName ) && isset ( $ foreignTableTca [ 'columns' ] [ $ foreignTableLabelField ] [ 'config' ] [ 'foreign_table' ] ) && $ this -> configuration [ 'enableRecursiveValueResolution' ] ) { // backup $ backupRecord = $ parentContentObject -> data ; $ backupConfiguration = $ this -> configuration ; // adjust configuration for next level $ this -> configuration [ 'localField' ] = $ foreignTableLabelField ; $ parentContentObject -> data = $ relatedRecord ; if ( strpos ( $ this -> configuration [ 'foreignLabelField' ] , '.' ) !== false ) { list ( , $ this -> configuration [ 'foreignLabelField' ] ) = explode ( '.' , $ this -> configuration [ 'foreignLabelField' ] , 2 ) ; } else { $ this -> configuration [ 'foreignLabelField' ] = '' ; } // recursion $ relatedItemsFromForeignTable = $ this -> getRelatedItemsFromForeignTable ( $ foreignTableName , $ relatedRecord [ 'uid' ] , $ foreignTableTca [ 'columns' ] [ $ foreignTableLabelField ] , $ parentContentObject ) ; $ value = array_pop ( $ relatedItemsFromForeignTable ) ; // restore $ this -> configuration = $ backupConfiguration ; $ parentContentObject -> data = $ backupRecord ; } return $ parentContentObject -> stdWrap ( $ value , $ this -> configuration ) ; }
Resolves the value of the related field. If the related field's value is
a relation itself, this method takes care of resolving it recursively.

@param array $relatedRecord Related record as array
@param array $foreignTableTca TCA of the related table
@param string $foreignTableLabelField Field name of the foreign label field
@param ContentObjectRenderer $parentContentObject cObject
@param string $foreignTableName Related record table name

@return string
Resolves the value of the related field . If the related field s value is a relation itself this method takes care of resolving it recursively .