Open zonky2 opened 4 years ago
Doch funktioniert in Version 3.4.9 - Getestet mit Text und Textarea.
dann bitte alle testen...
Okay, ich hab alle durchgetestet, die meiner Meinung nach Sinn ergeben haben. Gibt es eigentlich irgendwo eine Liste welche Felder der MCW überhaupt unterstützt?
Folgendes funktioniert mit Default-Festlegung:
Folgendes ging nicht, aber vielleicht geht das in Contao selbst auch nicht?
Folgendes hab ich ausgetestet, scheint nicht zu gehen, aber ergibt ohnehin keinen Sinn, dass man dann 2 Felder statt 1 erhält:
Bei folgendem Feld weiß ich nicht wie man einen default Wert definiert, auch wenn ich es durchaus interessant finden würde, wenn das gehen würde:
Fehlen jetzt noch irgendwelche Felder? https://docs.contao.org/dev/reference/dca/fields/ picker z.B. hab ich nicht zum Laufen bekommen, da braucht er wohl irgendwie eine Tabelle - wie auch immer man die übergibt?!
Code zum Testen für euch folgt:
$GLOBALS['TL_DCA'][$strTblName]['fields']['mcwtest2'] = array
(
'exclude' => true,
'inputType' => 'multiColumnWizard',
'eval' => array
(
//'columnsCallback' => array('tl_mcw_test', 'getTestFields'),
'columnFields' => array
(
'text' => array
(
'label' => 'text',
'default' => 'Bla',
'inputType' => 'text',
'eval' => array('rgxp'=>'digit', 'maxlength'=>5, 'style'=>'width:50px')
),
'textarea' => array
(
'label' => 'textarea',
'default' => 'Bla',
'inputType' => 'textarea',
'eval' => array('style'=>'width:50px')
),
'select' => array
(
'label' => 'select',
'default' => 'b',
'inputType' => 'select',
'options' => array('s' => 'Sidney', 'b' => 'Bristol'),
'eval' => array('includeBlankOption' => true)
),
'checkbox' => array
(
'label' => 'checkbox',
'default' => '1',
'inputType' => 'checkbox',
'eval' => array('style'=>'width:80px')
),
'checkboxWizard' => array
(
'label' => 'checkboxWizard',
'default' => 'b',
'inputType' => 'checkboxWizard',
'options' => array('s', 'b'),
'reference' => array('s' => 'Sidney', 'b' => 'Bristol'),
'eval' => array()
),
'radio' => array
(
'label' => 'radio',
'default' => 'b',
'inputType' => 'radio',
'options' => array('s' => 'Sidney', 'b' => 'Bristol'),
'eval' => array()
),
'textStore' => array
(
'label' => 'textStore',
'default' => 'Bla',
'inputType' => 'textStore',
'eval' => array()
),
'pageTree' => array
(
'label' => 'pageTree',
'default' => '104',
'inputType' => 'pageTree',
'eval' => array()
),
'file' => array
(
'label' => 'File',
'default' => 'files/dummy/galerie/abstrakt/dummy-1200x800-White.jpg',
'inputType' => 'fileTree',
'eval' => array('fieldType' => 'radio', 'files' => true, 'filesOnly' => true, 'multiple' => false, 'style'=>'width:150px')
)
),
),
'sql' => "blob NULL"
);
Okay, ich hab alle durchgetestet, die meiner Meinung nach Sinn ergeben haben. Gibt es eigentlich irgendwo eine Liste welche Felder der MCW überhaupt unterstützt?
=> im Prinzip alle, die per DCA aufrufbar sind... siehe https://docs.contao.org/dev/reference/dca/fields/#reference bei inputType
ich mache im ersten Post mal eine Checkboxliste...
Default für fileTree
: da muss m.E. das rein, wie es in der DB steht, d.h. die UUID(s) umgewandelt mit StringUtil::uuidToBin
- bei mehreren Dateien das Array dann noch serialisiert ... siehe https://github.com/contao/core-bundle/blob/master/src/Resources/contao/widgets/FileTree.php
Btw. wird das Contao Wiki eigentlich noch gepflegt oder bald abgeschaltet? Da steht ja auf der Startseite, dass die Seit zuletzt 2014 aktualisiert wurde? :(
https://de.contaowiki.org/MultiColumnWizard
Da steht "nospace" - "Ungetestet" - Ich hab es jetzt getestet und es funktioniert. Damit kann man ja verhindern, dass Leerzeichen eingegeben werden. 'nospace'=>true
Auch "trailingSlash" funktioniert.
Weitere Erkenntnisse...
tableWizard hab ich grad getestet, das funktioniert allgemein nicht mit MCW. Zum einen wird das Backend Layout komplett zerschossen und zum zweiten werden die getätigten Angaben nicht gespeichert. Daher stellt sich hier auch nicht die Frage, ob "default" funktioniert.
inputUnit mit default funktioniert. Hab ich gerade getestet.
'inputUnit' => array
(
'label' => 'inputUnit',
'default' => array('value' => '13', 'unit' => 'kg'),
'inputType' => 'inputUnit',
'options' => array('l','kg'),
'eval' => array('includeBlankOption' => true, 'rgxp'=>'digit')
),
'imageSize' => array
(
'label' => 'imageSize',
'default' => array(400, 300, 'right_top'),
'inputType' => 'imageSize',
'reference' => &$GLOBALS['TL_LANG']['MSC'],
'eval' => array('rgxp'=>'natural', 'includeBlankOption'=>true, 'nospace'=>true, 'helpwizard'=>true, 'tl_class'=>'w50'),
'options_callback' => static function ()
{
return Contao\System::getContainer()->get('contao.image.image_sizes')->getOptionsForUser(Contao\BackendUser::getInstance());
}
),
Default für
fileTree
: da muss m.E. das rein, wie es in der DB steht, d.h. die UUID(s) umgewandelt mitStringUtil::uuidToBin
- bei mehreren Dateien das Array dann noch serialisiert ... siehe https://github.com/contao/core-bundle/blob/master/src/Resources/contao/widgets/FileTree.php
Danke für den Tip! Hab es gerade getestet mit dem default im MCW. Und es funktioniert ebenso... ist ja super, dass das geht
Danke für den Tipp! Hab es gerade getestet mit dem default im MCW. Und es funktioniert ebenso... ist ja super, dass das geht
was genau hast Du eingetragen?
Einfach die uuid aus der Dateiverwaltung (Info Icon), z.B. dd8a031e-54da-11eb-8ca8-001a4a05040a
muss man nicht als Bin umwandeln?
Bei einer Einzeldatei zumindest nicht. Mehrfach-Auswahl hab ich jetzt nicht ausprobiert.
'file' => array
(
'label' => 'File',
'default' => 'dd8a031e-54da-11eb-8ca8-001a4a05040a',
'inputType' => 'fileTree',
'eval' => array('fieldType' => 'radio', 'files' => true, 'filesOnly' => true, 'multiple' => false, 'style'=>'width:150px')
)
Ich hab jetzt noch listWizard und moduleWizard testweise genutzt. Beides wird - ebenso wie tableWizard (wie ich zuvor erwähnt hatte), nicht durch den MCW gespeichert. Von daher ist ein Einsatz von "default" sowieso sinnlos ^^ Diese 3 Dinge sollten gestrichen werden.
listWizard wäre schon sinnvoll, aber das hat dann nichts mehr mit diesem Thema hier zu tun. Das sollte dann erst mal grundsätzlich speicherbar sein. Erst danach ergibt ein Test des "default" Themas diesbezüglich Sinn.
moduleWizard ist darüber hinaus unvollständig und total unlogisch, um es hier einzusetzen. Das wird beim Core lediglich hier eingesetzt: https://github.com/contao/core/blob/303023b5f0b92de97437ce4fb656cdd067c207ed/system/modules/core/dca/tl_layout.php#L295
Ich schlussfolgere daraus, dass auch der Einsatz von sectionWizard (Used for defining sections in the page layout) absolut sinnfrei ist :)
'listWizard' => array
(
'label' => 'listWizard',
'inputType' => 'listWizard',
'eval' => array('allowHtml'=>true, 'multiple'=>true),
),
'modules' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_layout']['modules'],
'default' => array(array('mod'=>0, 'col'=>'main', 'enable'=>1)),
'exclude' => true,
'inputType' => 'moduleWizard',
'eval' => array('multiple'=>true)
),
'tableWizard' => array
(
'label' => 'tableWizard',
'inputType' => 'tableWizard'
),
o.k. - in Liste geändert
Was machen wir mit listWizard und tableWizard? Neues Ticket aufmachen, damit die Funktionalität an sich erst mal ermöglicht wird?
neue Tickets
Weitere Tests... Aber default hab ich jeweils noch nicht ausprobiert.
keyValueWizard = Wird nicht durch den MCW gespeichert und ergibt auch keinen Sinn, wozu brauch ich an dieser Stelle Schlüssel und Wert??? Das wird irgendwie im Theme und in den Stylesheets für globale Variablenersetzungen verwendet.
chmod = Wird im MCW gespeichert, aber der Einsatzzweck für MCW erschließt sich mir nicht wirklich. Das steuert die Zugriffsrechte für Seiten und Artikel.
optionWizard = Wird nicht durch den MCW gespeichert und ergibt auch nur geringfügig Sinn. Wofür braucht man so etwas? Das Ding ist ja quasi "MCW light". Das sind die Optionen, die man aus dem Formulargenerator kennt bei Checkbox Menü und Select.
radioTable = Wird im MCW gespeichert, könnte einigermaßen sinnvoll sein. Mir fällt gerade kein sinnvoller Einsatzweck ein, aber damit kann man z.B. wie beim Inhaltselement Text die Bildausrichtung bestimmen.
timePeriod = Wird im MCW gespeichert, der Sinn bzw. Vorteil gegenüber inputUnit erschließt sich mir nicht. Das wird glaube ich bei wiederholenden Events in Cotao eingesetzt.
'keyValueWizard' => array
(
'inputType' => 'keyValueWizard',
),
'chmod' => array
(
'inputType' => 'chmod',
),
'optionWizard' => array
(
'inputType' => 'optionWizard',
),
'radioTable' => array
(
'exclude' => true,
'inputType' => 'radioTable',
'options' => array('above', 'left', 'right', 'below'),
'eval' => array('cols'=>4, 'submitOnChange'=>true),
'reference' => &$GLOBALS['TL_LANG']['MSC']
),
'timePeriod' => array
(
'inputType' => 'timePeriod',
'inputType' => 'timePeriod',
'options' => ['seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years'],
'reference' => &$GLOBALS['TL_LANG']['tl_calendar_events']['subscription_timeRef'],
'eval' => ['rgxp' => 'natural', 'minval' => 1, 'tl_class' => 'w50']
),
chmod und keyValueWizard aus Liste verschoben
Folgende inputTypes funktionieren ebenso mit default... damit sind wir dann so gut wie durch:
listWizard - 'default' => array('Listenpunkt 1', 'Listenpunkt 2'),
optionWizard - ''default' => array(array('value' => 'achtung', 'label' => 'Achtung'), array('value' => 'alarm', 'label' => 'Alarm')),
radioTable - 'default' => 'right',
(Key des Options-Array-Items)
timePeriod - 'default' => array('value' => '13', 'unit' => 'days'),
(unit-Wert aus Options-Array)
trbl - default Übergabe mittels array, keys = top, right, bottom, left*
picker - krieg ich grundsätzlich nicht zum laufen. Was muss man da im DCA einstellen???
Ergibt das Sinn trbl einzusetzen? Das ist doch das Teil aus den Stylesheets. Wird das sonst noch irgendwo benutzt? Wenn nein, fliegt das mit Contao 5 doch bestimmt sowieso aus dem System raus.
'trbl' => array
(
'inputType' => 'trbl',
'default' => array('top' => '2'),
),
mit trbl dütftest Du recht haben...
Picker: z.B.
'mcw_textfp' => [
'label' => ['mcw_textfp'],
'exclude' => true,
'inputType' => 'text',
'eval' => [
'style' => 'width:40 % ',
'decodeEntities' => true,
'maxlength' => 255,
'fieldType' => 'checkbox',
'filesOnly' => false,
/*'dcaPicker' => ['providers' => ['filePicker']],*/
'dcaPicker' => ['providers' => ['pagePicker']],
/*'fieldType'=>'checkbox',*/
/*'filesOnly'=>true,*/
],
],
Danke. Das ist doch aber nicht inputType => picker?! Wenn ich als inputType = picker wähle, dann knallt das ganze BE weg. "Internal Server Error - The table name must not be empty"
Weder die Übergabe von relation, noch von foreignKey etc. funktioniert. Allerdings hab ich es innerhalb des MCW getestet. Vielleicht funktioniert es ja außerhalb?
Wenn ich z.B. picker2 eintragen, dann funktioniert das BE weiterhin. Es muss also mehr dahinter stecken.
Btw. warum schreibst du eigentlich exclude als Attribut rein? Greift das überhaupt beim MCW?
Hier noch die Angabe für tableWizard: 'default' => array(array('Zelle A1', 'Zelle A2'), array('Zelle B1', 'Zelle B2')),
Bei dem von dir genannten picker muss man ein Insert Tag übergeben, z.B. 'default' => '{{link_url::3}}',
für Seite mit der ID 3
Dieses funktioniert also ebenso. Damit ist das default Thema eig. abgeschlossen, aber das mit dem picker ist halt leider noch unklar. Wobei ich mir nicht vorstellen kann, dass dort default nicht geht.
@zonky2 tableWizard kannst du abhaken, Siehe mein Beitrag vom 19. Januar.
Nochmal zum picker: Ich weiß nicht, ob man das Thema deswegen offen lassen muss, da doch irgendwie noch nicht mal jemand ne Ahnung hat wie man das allgemein in Contao (ohne MCW) verwenden kann? Kann ja nicht sein, dass ihr eine Dokumentation aufbauen müsst, die Contao selbst noch nicht mal bietet :D Auch die default Geschichte allgemein geht schon deutlich über das Contao Handbuch hinaus.
auf Slack gabs zum Picker das Beispiel
'news' => [
'inputType' => 'picker',
'relation' => ['type' => 'hasOne', 'load' => 'eager', 'table' => 'tl_news'],
// ...
],
k.A. ob da überhaut ein default vorgesehen ist
Auch wenn man einem Feld einen Default-Wert zuweist, wird dieser nicht ausgegeben.
siehe https://github.com/menatwork/MultiColumnWizard/issues/260
Typen lt. https://docs.contao.org/dev/reference/dca/fields/#reference bei inputType
'default' => '1',
'default' => '2',
(Key des Options-Array-Items)'default' => 'dd8a031e-54da-11eb-8ca8-001a4a05040a'
(UUID der Datei)'default' => [400, 300, 'right_top'],
'default' => ['value' => '42', 'unit' => 'kg'],
(unit-Wert aus Options-Array)'default' => ['Listenpunkt 1', 'Listenpunkt 2']
'default' => [['value' => 'achtung', 'label' => 'Achtung'], ['value' => 'alarm', 'label' => 'Alarm']]
'default' => '42',
(id der Seite)'default' => '2',
(Key des Options-Array-Items)'default' => 'right'
(Key des Options-Array-Items)'default' => '2',
(Key des Options-Array-Items)'default' => [['Zelle A1', 'Zelle A2'], ['Zelle B1', 'Zelle B2']]
'default' => 'Hallo Welt',
'default' => 'Hallo Welt',
'default' => ['value' => '13', 'unit' => 'days']
(unit-Wert aus Options-Array)'default' => ['top' => '2']
(keys = top, right, bottom, left)Die Folgenden Widgets machen keinen Sinn: