georgringer/country-backport

TYPO3 v12国家列表向后移植到TYPO3 v11

0.0.2 2023-02-08 08:33 UTC

This package is auto-updated.

Last update: 2024-08-29 21:41:39 UTC


README

此扩展将TYPO3 v12的国家功能向后移植到TYPO3 v11 + 10。有关详细信息,请参阅https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Documentation/Changelog/12.2/Feature-99618-ListOfCountriesInTheWorldAndTheirLocalizedNames.rst

安装

使用 composer req georgringer/country-backport 或从TER下载扩展

使用

使用此扩展与核心相同,但使用不同的命名空间

 <html
       xmlns:country="http://typo3.org/ns/GeorgRinger/CountryBackport/ViewHelpers">

    <country:form.countrySelect
        name="country"
        value="AT"
        sortByOptionLabel="true"
        prioritizedCountries="{0: 'DE', 1: 'AT', 2: 'CH'}"
    />
</html>
$countryProvider = GeneralUtility::makeInstance(\GeorgRinger\CountryBackport\Country\CountryProvider);
$france = $countryProvider->getByIsoCode('FR');
// or
$france = $countryProvider->getByName('France');
// or
$france = $countryProvider->getByAlpha3IsoCode('FRA');
// or
$filter = new \GeorgRinger\CountryBackport\Country\CountryFilter();
$filter->setExcludeCountries(['DE', 'AT']);
$filter->setOnlyCountries(['FR', 'IT', 'AT']);
$list = $countryProvider->getFiltered($filter);