-
DataContainer File
Ich will ein DCA machen, ohne mehrere Einträge. Also wie z.B. die Grundeinstellungen. Ich schaffe es auch das Formular im Backend zu sehen, aber wie komme ich beim "onSubmitCallback" an die im Formular eingetragenen Daten?
Bei einer Tabelle wäre es z.B.
PHP-Code:
$dc->activeRecord->wertX
aber das scheint für den Type "File" nicht zu funktionieren.
-
Im onsubmit_callback ist der activeRecord nie vorhanden, soweit ich weiß.
-
Wenn ich das DCA als Tabelle anlegen bekomme ich so aber die Werte von den Feldern.
Meine momentane Config:
PHP-Code:
'config' => array
(
'closed' => true,
'onsubmit_callback' => array(array('Branding_class', 'myOnsubmitCallback')),
'dataContainer' => 'Table'
),
PHP-Code:
class Branding_class
{
/**
* onsubmit_callback: Wird beim Abschicken eines Backend-Formulars ausgeführt.
* @param $dc
*/
public function myOnsubmitCallback($dc){
$string="/* Brand Colors Primary */
--spotcolor1: #". $dc->activeRecord->spotcolor1.";
--spotcolor2: #". $dc->activeRecord->spotcolor2.";
/* Greytones */
--black: #".$dc->activeRecord->black.";
--midgrey: #".$dc->activeRecord->midgrey.";
--lightgrey: #".$dc->activeRecord->lightgrey.";
--white: #". $dc->activeRecord->white.";
--bodybackground: #".$dc->activeRecord->bodybackground.";
/* UI Colors */
--error: #".$dc->activeRecord->error.";
--success: #".$dc->activeRecord->success.";
--info: #".$dc->activeRecord->info.";
--signal: #".$dc->activeRecord->signal.";
--warning: #".$dc->activeRecord->warning.";
--inactive: #". $dc->activeRecord->inactive.";
";
file_put_contents("path",$string);
}
Es enthält die korrekten Werte.
Aber für File muss ich etwas anders machen, da dort activeRecord tatsächlich nicht existiert.