Zum Inhalt springen

fe_mergeTSconfFlex verursacht fehler keine ausgabe mehr

Erstellt am 16. März 2010 · 6 Antworten · letzte Antwort am 16. März 2010

Tags: FlexForms, Frage

henno ·

Ich versuche meine TS conf mit der flexform conf zu syncronisieren

           $flex2conf = array(
			'view' => 'sDEF:view',
		);// Mapping array for PI flexform		
		$this->pi_initPIflexForm();// Init flexform configuration of the plugin
		$piFlexForm = array();
		$piFlexForm = $this->cObj->data['pi_flexform'];// Get flexform informations
		$aConf = $this->api->fe_mergeTSconfFlex($flex2conf,$conf,$piFlexForm);// Ovverride TS setup with flexform

Als Ausgabe erhalte ich allerdings eine komplett weiße Seite auch alle Elemente die sonst auf der Seite sind sind weg. Der Quellcode der Seite ist einfach komplett leer sobald ich die Funktion verwende.

ammannd ·

Bei mir sieht das so aus:

/**
 * Read the flexform configuration and merge it with TS Setup config
 */
function getFlexformConfig()	{
	$this->pi_initPIflexForm();
	$piFlexForm = $this->cObj->data['pi_flexform'];
	foreach ($piFlexForm['data'] as $sheet => $data) {
		foreach ($data as $lang => $value) {
			foreach ($value as $key => $val) {
				$v = $this->pi_getFFvalue($piFlexForm, $key, $sheet);
				$this->conf[$key] = empty($v) ? $this->conf[$key] : $v;
			}
		}
	}
}
henno ·

nochmal danke an euch beide! aufgrund des Artikels wollte ich mir gerade genau so was von ammannd bauen.

Funktioniert! 😃

einpraegsam.​net ·

so ähnlich bei mir...

In der Hauptklasse:

$this->pi_initPIflexForm();
$this->div = t3lib_div::makeInstance('tx_ext_div');
$this->div->flex2conf($this);

In einer Nebenklasse (div):

/**
 * Add flexform values to conf array
 *
 * @param	array		$pobj: Parent Object
 * @return	void
 */
public function flex2conf(&$pObj) {
	if (is_array($pObj->cObj->data['pi_flexform']['data'])) { // if there are flexform values
		foreach ($pObj->cObj->data['pi_flexform']['data'] as $key => $value) { // every flexform category
			if (count($pObj->cObj->data['pi_flexform']['data'][$key]['lDEF']) > 0) { // if there are flexform values
				foreach ($pObj->cObj->data['pi_flexform']['data'][$key]['lDEF'] as $key2 => $value2) { // every flexform option
					if ($pObj->pi_getFFvalue($pObj->cObj->data['pi_flexform'], $key2, $key)) { // if value exists in flexform
						$pObj->conf[$key.'.'][$key2] = $pObj->pi_getFFvalue($pObj->cObj->data['pi_flexform'], $key2, $key); // overwrite $conf
					}
				}
			}
		}
	}
}

Vermutlich führen alle Wege nach Rom.

Wichtig: Während man den Werten aus typoscript trauen kann (darf nur der Admin ändern), kann man u.U. den Werten aus der Flexform nicht trauen (vom Redakteur)

ammannd ·
einpraegsam.net schrieb

Wichtig: Während man den Werten aus typoscript trauen kann (darf nur der Admin ändern), kann man u.U. den Werten aus der Flexform nicht trauen (vom Redakteur)

finde ich eine wichtige anmerkung!!!