---
title: "TypoScript und FlexForm => leere Einstellung ignorieren"
url: "https://www.typo3.net/d/117164-typoscript-und-flexform-leere-einstellung-ignorieren"
source: "typo3.net"
tags: ["Extensions","Extbase","Frage"]
created: "2014-01-20"
last_reply: "2014-01-29"
replies: 2
solved: false
page: 1
pages: 1
lang: "de"
---

# TypoScript und FlexForm => leere Einstellung ignorieren

Extensions › Extbase · 2 Antworten · gestartet 2014-01-20

## Eröffnungsbeitrag

**intensivstation** · 2014-01-20 · [Beitrag #1](https://www.typo3.net/d/117164-typoscript-und-flexform-leere-einstellung-ignorieren/1)

Früher konnte man ja selbst bestimmen, wann FlexForm-Einstellungen die TypoScript-Einstellung überschreiben soll. Bei Extbase geschieht dies automatisch so: FlexForm überschreibt TypoScript, auch wenn über FlexForm nichts gewählt wurde.
Das ist blöd so. Wenn ich z.B. eine singlePid über TypoScript angebe, möchte ich, dass die übernommen wird, wenn man keine singlePid über die FlexForms auswählt.
Im Moment wird die TypoScript-Einstellung auch mit einer leeren FlexForm-Einstellung überschrieben.
Wie kann man das am besten verhindern?

## Antworten

### [#2](https://www.typo3.net/d/117164-typoscript-und-flexform-leere-einstellung-ignorieren/2) · froemken · 2014-01-25

Hallo Intensivstation,

tja...blöde Sache. Dieses Thema gibt ständig neue Diskussionen. Musst Du Dir selbst bauen. Riskier mal einen Blick in die news-Extension:

<https://github.com/TYPO3-extensions/news/blob/master/Classes/Controller/NewsController.php>

injectConfigurationManager

Stefan

### [#3](https://www.typo3.net/d/117164-typoscript-und-flexform-leere-einstellung-ignorieren/3) · intensivstation · 2014-01-29

Das haut in Typo3 6.1 nicht mehr hin, da CONFIGURATION_TYPE_FRAMEWORK schon die gemergten Settings zurück liefert. Aber ich wurde hier noch fündig:
<https://svn.typo3.org/TYPO3v4/Extensions/me_google_calendar/trunk/Classes/Controller/CalendarController.php>
Damit sieht dann meine Lösung nun so aus:

```php
	public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager) {
		$this->configurationManager = $configurationManager;

		$tsSettings = $this->configurationManager->getConfiguration(
			\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT
		);
		$tsSettings = $tsSettings['plugin.']['tx_camaliga.']['settings.'];
		$originalSettings = $this->configurationManager->getConfiguration(
			\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS
		);
		
		// start override
		if (isset($tsSettings['overrideFlexformSettingsIfEmpty']) && $tsSettings['overrideFlexformSettingsIfEmpty']==1) {
			// if flexform setting is empty and value is available in TS
			foreach ($tsSettings as $key=>$value) {
				if ($key == 'img.') continue;
				if (!$originalSettings[$key] && isset($value)) $originalSettings[$key] = $value;
			}
			foreach ($tsSettings['img.'] as $key=>$value) {
				if (!$originalSettings['img'][$key] && isset($value)) $originalSettings['img'][$key] = $value;
			}
		}
		$this->settings = $originalSettings;
	}
```

---

Quelle: „TypoScript und FlexForm => leere Einstellung ignorieren“, typo3.net, https://www.typo3.net/d/117164-typoscript-und-flexform-leere-einstellung-ignorieren
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
