src/PeskyCMF/Scaffold/ScaffoldSectionConfig.php
protected function prepareRelatedRecord($relationName, array $relationRecordData, $index = null) {
        $recordWithBackup = $relationRecordData;
        $valueViewers = $this->getViewersForRelations();
        foreach ($relationRecordData as $columnName => $value) {
            $viewerName = $relationName . '.' . ($index === null ? '' : $index . '.') . $columnName;
            if (
                array_key_exists($viewerName, $valueViewers)
                && $valueViewers[$viewerName]->getRelation()->getName() === $relationName
            ) {
                $recordWithBackup[$columnName] = $recordWithBackup['__' . $columnName] = $value;
                $valueViewer = $valueViewers[$viewerName];
                if (
                    is_object($valueViewer)
                    && method_exists($valueViewer, 'convertValue')
                    && (
                        !method_exists($valueViewer, 'isVisible')
                        || $valueViewer->isVisible()
                    )
                ) {
                    $recordWithBackup[$columnName] = $valueViewer->convertValue(
                        $recordWithBackup[$columnName],
                        $relationRecordData
                    );
                }
            }
        }
        return $recordWithBackup;
    }
protected function prepareRelatedRecord($relationName, array $relationRecordData, $index = null) {
        $recordWithBackup = $relationRecordData;
        $valueViewers = $this->getViewersForRelations();
        foreach ($relationRecordData as $columnName => $value) {
            $viewerName = $relationName . '.' . ($index === null ? '' : $index . '.') . $columnName;
            if (
                array_key_exists($viewerName, $valueViewers)
                && $valueViewers[$viewerName]->getRelation()->getName() === $relationName
            ) {
                $recordWithBackup[$columnName] = $recordWithBackup['__' . $columnName] = $value;
                $valueViewer = $valueViewers[$viewerName];
                if (
                    is_object($valueViewer)
                    && method_exists($valueViewer, 'convertValue')
                    && (
                        !method_exists($valueViewer, 'isVisible')
                        || $valueViewer->isVisible()
                    )
                ) {
                    $recordWithBackup[$columnName] = $valueViewer->convertValue(
                        $recordWithBackup[$columnName],
                        $relationRecordData
                    );
                }
            }
        }
        return $recordWithBackup;
    }
Process related record's data by viewers attached to it
@param string $relationName
@param array $relationRecordData
@param null|string $index - string: passed for HAS_MANY relation | null: for relations other then HAS_MANY
@return array
@throws \UnexpectedValueException
@throws \PeskyCMF\Scaffold\ValueViewerConfigException
@throws \InvalidArgumentException
@throws \BadMethodCallException