Closed alxndr-w closed 7 months ago
Gefällt mir. @joachimdoerr was denkst du?
@joachimdoerr - wenn das angenommen würde, würde ich mir noch Gedanken um einen Bereich "Migration" machen, wie man MForm 7.x zu 8.x möglichst schnell geändert bekommt.
Für mich ist das OK, macht einfach. Ich habe leider aktuell keine Zeit um mich zu kümmern.
@skerbis ich bräuchte dann als nächstes grundlegende Beispiele für den Repeater und auch, was sich von 7 auf 8 noch ändert.
Mir schwebt vor, fertige Beispiele für "Suchen und Ersetzen" zu liefern, mit denen man auf einen Schlag alle Module aktualisieren könnte - wo es möglich ist.
Ich habe aktuell nur ein einziges Beispiel
Bin selbst nicht ganz auf dem Laufenden. (sollte ich aber langsam mal wieder)
<?php
$mform = MForm::factory()
->addTextField(1, ['label' => 'test rex value 1'])
->addRepeaterElement(2,
MForm::factory()->addFieldsetArea('fieldset1',
MForm::factory()
->addTextField('test1', ['label' => 'test1'])
->addMediaField('media1', ['label' => 'media1'])
->addCustomLinkField('link1', ['label' => 'link1'])
->addTextAreaField('text1', ['class' => 'cke5-editor', 'data-profile' => 'light'])
// ->addImagelistField('imagelist1', ['label' => 'Image List1'])
->addFieldsetArea('Select elements', MForm::factory()
// some select fields
->addSelectField("selectfield11", [1 => 'test-1', 2 => 'test-2', 3 => 'test-3', 4 => 'test-4'], ['label' => 'Select optgroup11'])
->addSelectField("selectfield12", ['group 1' => [1 => 'test-1', 2 => 'test-2'], 'group 2' => [3 => 'test-3', 4 => 'test-4']], ['label' => 'Select optgroup12'])
)
// add second fieldset area
->addFieldsetArea('Multiselect elements', MForm::factory()
// some multiple selects fields
->addMultiSelectField("selectfield13", [1 => 'test-1', 2 => 'test-2', 3 => 'test-3', 4 => 'test-4'], ['label' => 'Select optgroup13'])
->addMultiSelectField("selectfield14", ['group 1' => [1 => 'test-1', 2 => 'test-2'], 'group 2' => [3 => 'test-3', 4 => 'test-4']], ['label' => 'Select optgroup14'])
)
// add fieldset area
->addFieldsetArea('Checkbox element', MForm::factory()
// some checkbox elements
->addCheckboxField('checkbox1', [1 => 'test-1'], ['label' => 'Checkbox1'])
->addToggleCheckboxField('togglecheckbox1', [1 => 'Toggle test-1'], ['label' => 'Toggle Checkbox1'])
)
// add second fieldset area
->addFieldsetArea('Radio buttons element', MForm::factory()
// radio element
->addRadioField('radio1', [1 => 'test-1', 2 => 'test-2'], ['label' => 'Radio1'])
)
->addRepeaterElement('fields1',
MForm::factory()->addFieldsetArea('fieldset',
MForm::factory()
// ->addImagelistField('imagelist2', ['label' => 'Image List2'])
->addFieldsetArea('Select elements', MForm::factory()
// some select fields
->addSelectField("selectfield21", [1 => 'test-1', 2 => 'test-2', 3 => 'test-3', 4 => 'test-4'], ['label' => 'Select optgroup21'])
->addSelectField("selectfield22", ['group 1' => [1 => 'test-1', 2 => 'test-2'], 'group 2' => [3 => 'test-3', 4 => 'test-4']], ['label' => 'Select optgroup22'])
)
// add second fieldset area
->addFieldsetArea('Multiselect elements', MForm::factory()
// some multiple selects fields
->addMultiSelectField("selectfield23", [1 => 'test-1', 2 => 'test-2', 3 => 'test-3', 4 => 'test-4'], ['label' => 'Select optgroup23'])
->addMultiSelectField("selectfield24", ['group 1' => [1 => 'test-1', 2 => 'test-2'], 'group 2' => [3 => 'test-3', 4 => 'test-4']], ['label' => 'Select optgroup24'])
)
->addFieldsetArea('Checkbox element', MForm::factory()
// some checkbox elements
->addCheckboxField('checkbox2', [1 => 'test-1'], ['label' => 'Checkbox2'])
->addToggleCheckboxField('togglecheckbox2', [1 => 'Toggle test-1'], ['label' => 'Toggle Checkbox2'])
)
// add second fieldset area
->addFieldsetArea('Radio buttons element', MForm::factory()
// radio element
->addRadioField('radio2', [1 => 'test-1', 2 => 'test-2'], ['label' => 'Radio2'])
)
->addTextField('test2', ['label' => 'test2'])
->addMediaField('media2', ['label' => 'media2'])
->addCustomLinkField('link2', ['label' => 'link2'])
->addLinkField('link3', ['label' => 'link3'])
->addTextAreaField('text2', ['class' => 'cke5-editor', 'data-profile' => 'light'])
->addTabElement('test1',MForm::factory()
->addTextField('test3', ['label' => 'fields1 test1'])
->addCustomLinkField('link4', ['label' => 'link2'])
,true)
->addTabElement('test2',MForm::factory()->addTextField('test4', ['label' => 'fields1 test2']))
)
)
->addRepeaterElement('fields2',
MForm::factory()
->addTextField('test0', ['label' => 'fields2 test0'])
, ['hidden_button' => false, 'button_text' => 'add Fields 2']
)
)
);
echo MForm::factory()
->addTabElement('tab test1',$mform,true)
->addTabElement('tab test2',MForm::factory()->addTextField('test1', ['label' => 'fields1 test2']))
->show();
//echo MForm::factory()
// ->addTabElement('test1',MForm::factory()->addTextField('test1', ['label' => 'fields1 test1']),true)
// ->addTabElement('test2',MForm::factory()->addTextField('test1', ['label' => 'fields1 test2']))
// ->show();
Diese Struktur bietet die Grundlage für weitere Beiträge meinerseits, bspw. Screenshots der Elemente oder fertige Kombinationen von MForm-Modulen, bspw. einen Text-mit-Bild-Modul, etc.
Was mir an MForm gefällt ist dieses Kopieren-Anpassen-Fertig-Prinzip, das würde ich gerne weiter verbessern.