Project

General

Profile

Actions

Feature #92042

closed

Extend site language

Added by Marc Hirdes over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-08-18
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Hi,

to extend the site language with an own field is possible like it is explained here

https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/SiteHandling/ExtendingSiteConfig.html

Add a file Configuration\SiteConfiguration\Overrides\sites.php and inside

// Configure a new simple required input field to site
$GLOBALS['SiteConfiguration']['site_language']['columns']['myNewField'] = [
    'label' => 'A new custom field',
    'config' => [
        'type' => 'input',
    ],
];

// And add it to showitem
$GLOBALS['SiteConfiguration']['site_language']['types']['1']['showitem'] = str_replace(
    'flag,',
    'myNewField, flag,',
    $GLOBALS['SiteConfiguration']['site_language']['types']['1']['showitem']
);

But there is no way to read the value of the myNewField.

For the site configuration there is a public method getConfiguration(). It would be great to have the same for the SiteLanguage.

Actions #1

Updated by Georg Ringer over 3 years ago

  • Status changed from New to Needs Feedback

taken from ContentObjectRenderer

 $request = $GLOBALS['TYPO3_REQUEST'] ?? null;
                        $siteLanguage = $request ? $request->getAttribute('language') : null;
                        if ($siteLanguage instanceof SiteLanguage) {
                            $config = $siteLanguage->toArray();
                            if (isset($config[$key])) {
                                $retVal = $config[$key];
                            }
                        }
                        break;

does that work for you?

Actions #2

Updated by Marc Hirdes over 3 years ago

Yes, thanks a lot.

Actions #3

Updated by Georg Ringer over 3 years ago

  • Status changed from Needs Feedback to Closed
Actions

Also available in: Atom PDF