Skip to content

Commit

Permalink
use translated recipient records in T3 11.5
Browse files Browse the repository at this point in the history
The previous implementation only worked in T3 10.4
  • Loading branch information
akiessling committed May 8, 2023
1 parent b850187 commit 28d595c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Classes/Hooks/FormElementsOnSubmitHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Extrameile\FormDynamicRecipient\Hooks;

use Extrameile\FormDynamicRecipient\Domain\Model\Recipient;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Form\Domain\Model\Renderable\RenderableInterface;
Expand Down Expand Up @@ -69,17 +70,25 @@ private function getRecipient($uid)

if ($row) {
$GLOBALS['TSFE']->sys_page->versionOL(Recipient::TABLE, $row, true);

// Language overlay:
if (\is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
$row = $GLOBALS['TSFE']->sys_page->getRecordOverlay(
$languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language');
if (is_array($row) && $languageAspect->getContentId() > 0) {
$row = $this->getTsfe()->sys_page->getLanguageOverlay(
Recipient::TABLE,
$row,
$GLOBALS['TSFE']->sys_language_content,
$GLOBALS['TSFE']->sys_language_contentOL
$row
);
}
}

return $row;
}

/**
* @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
*/
private function getTsfe()
{
return $GLOBALS['TSFE'];
}
}

0 comments on commit 28d595c

Please sign in to comment.