Hallo zusammen - also iwi will dat nicht so wie ich das gerne hätte:
Eckdaten:
- Contao 2.11.12
- calendarfield 1.4.1 stable 4
Code:
system/modules/z_maketstamp/config/config.php:
Code:
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
$GLOBALS['TL_HOOKS']['storeFormData'][] = array('maketstamp', 'storeFormData');
?>
system/modules/z_maketstamp/maketstamp.php:
Code:
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
class maketstamp extends Frontend
{
public function storeFormData($arrSet)
{
if ($arrForm['id'] != 16)//verwende Formular 16
{
$objDate = new \Date($arrSet['mp_date']);
$arrSet['mp_date'] = $objDate->tstamp;
return $arrSet;
}
}
}
Der tstamp wird im Formular 16 auch korrekt abgespeichert.
Jetzt hab ich allerdings das Problem, dass andere Formulare nicht mehr funzen.
Es kommt folgende Fehlermeldung:
Fatal error: Uncaught exception
Exception with message
Query error: Unknown column 'mp_date' in 'field list' (INSERT INTO mm_gerichte (tstamp, category, gericht, note, mp_date) VALUES ('1382188974', '4', 'x', '1', -3600)) thrown in
…/system/libraries/Database.php on line
686
Eigentlich müsste der Code in etwa so lauten:
Code:
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
class maketstamp extends Frontend
{
public function storeFormData($arrSet)
{
if ($arrForm['id'] != 16)
{
return;
}
$objDate = new \Date($arrSet['mp_date']);
$arrSet['mp_date'] = $objDate->tstamp;
return $arrSet;
}
}
allerdings krieg ich dann folgende Fehlermeldung:
Warning: Invalid argument supplied for foreach() in
…/system/libraries/Database.php on line
729
leider komm ich da nicht dahinter - eigentlich hätte ich ja die Bedingung, dass der Hook nur durchgeführt werden soll, wenn ich Form#16 verwende.
Kann mir evtl. jemand behilflich sein?
Lesezeichen