Skip to content

Commit 6f0fc5f

Browse files
georgringerbmack
authored andcommitted
[BUGFIX] Transform ISO code of countries to its name in EXT:form
Using a country select field in EXT:form should always show the name of the country and not its ISO2 code. Resolves: #102348 Releases: main, 13.4 Change-Id: I359e37281e2b62b3083cbd2c25ef417ec43aea69 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84855 Tested-by: core-ci <typo3@b13.com> Tested-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Benni Mack <benni@typo3.org> Reviewed-by: Oliver Bartsch <bo@cedev.de> Tested-by: Benni Mack <benni@typo3.org>
1 parent 6675d2d commit 6f0fc5f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

typo3/sysext/form/Classes/ViewHelpers/RenderFormValueViewHelper.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
namespace TYPO3\CMS\Form\ViewHelpers;
2323

24+
use TYPO3\CMS\Core\Country\CountryProvider;
2425
use TYPO3\CMS\Core\Resource\File;
26+
use TYPO3\CMS\Core\Utility\GeneralUtility;
2527
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
2628
use TYPO3\CMS\Form\Domain\Model\FormElements\FormElementInterface;
2729
use TYPO3\CMS\Form\Domain\Model\FormElements\StringableFormElementInterface;
@@ -96,6 +98,12 @@ protected function processElementValue(
9698
) {
9799
$properties = $element->getProperties();
98100
$options = $properties['options'] ?? null;
101+
if ($element->getType() === 'CountrySelect') {
102+
$country = GeneralUtility::makeInstance(CountryProvider::class)->getByIsoCode($value);
103+
if ($country !== null) {
104+
return $country->getName();
105+
}
106+
}
99107
if (is_array($options)) {
100108
$options = (array)$this->renderingContext->getViewHelperInvoker()->invoke(
101109
TranslateElementPropertyViewHelper::class,

0 commit comments

Comments
 (0)