RELAXO MFORM 7
// init mform
$mform = MForm::factory()
// add fieldset area
->addFieldsetArea('Checkbox element', MForm::factory()
// some checkbox elements
->addCheckboxField(1, [1 => 'test-1'], ['label' => 'Checkbox'])
->addToggleCheckboxField(3, [1 => 'Toggle test-1'], ['label' => 'Toggle Checkbox'])
)
// add second fieldset area
->addFieldsetArea('Radio buttons element', MForm::factory()
// radio element
->addRadioField(2, [1 => 'test-1', 2 => 'test-2'], ['label' => 'Radio Buttons'])
)
->addFieldsetArea('Fieldset Element', MForm::factory()
// headline, description and some other elements
->addHeadline('MForm Demo Headline')
->addDescription('Mform Demo Description for any descriptions texts in your modul input formular.')
->addHtml('<b>HTML <i>Text</i></b><br>')
)
// add second fieldset area
->addFieldsetArea('Alert Messages', MForm::factory()
->addAlertInfo('Info Alert Message')
->addAlertDanger('Danger Alert Message')
->addAlertSuccess('Success Alert Message')
->addAlertWarning('Warning Alert Message')
->addAlertError('Error Alert Message')
)
// add third fieldset area
->addFieldsetArea('', MForm::factory()
// toogle checkbox with tooltip
->addToggleCheckboxField(2, [1 => 'Test-Checkbox'], ['label' => 'Checkbox'])
->setTooltipInfo('Tooltip Test-Checkbox Label.', 'fa-question-circle')
)
->addFieldsetArea('Select elements', MForm::factory()
// some select fields
->addSelectField("1.0", [1 => 'test-1', 2 => 'test-2', 3 => 'test-3', 4 => 'test-4'], ['label' => 'Select optgroup'])
->addSelectField("1.1", ['group 1' => [1 => 'test-1', 2 => 'test-2'], 'group 2' => [3 => 'test-3', 4 => 'test-4']], ['label' => 'Select optgroup'])
)
// add fieldset area
->addFieldsetArea('Media file elements', MForm::factory()
// some media fields
// ->addMedialistField(1, array('label' => 'Image list'))
->addImagelistField(1, ['label' => 'Image List'])
)
// add second fieldset area
->addFieldsetArea('Link elements', MForm::factory()
// some link elements
->addLinkField(1, array('label' => 'Link'))
->addLinklistField(1, array('label' => 'Link list'))
->addCustomLinkField(1, ['label' => 'Custom Link', 'data-intern' => 'enable', 'data-extern' => 'enable', 'data-media' => 'enable', 'data-mailto' => 'enable', 'data-tel' => 'enable'])
->addCustomLinkField(5, ['label' => 'Verlinkung Button nur intern oder extern', 'data-media' => 'disable', 'data-mailto' => 'disable', 'widget' => 'disable', 'data-intern' => 'enable', 'data-extern' => 'enable'])
)
// add fieldset area
->addFieldsetArea('Input Text elements', MForm::factory() // init new mform
// add some text fields
->addTextField(1.0, ['label' => 'Input Text'])
->addTextField(1.2, ['label' => 'With options and Full width', 'full' => true])
->setOptions([1 => 'option1', 2 => 'option2'])
)
// add second fieldset area
->addFieldsetArea('Textarea elements', MForm::factory() // init new mform
->addTextAreaField(1.3, ['label' => 'Textarea'])
->addTextAreaField(1.4, ['label' => 'Full width'])
->addTextAreaField(1.5, ['label' => 'Text CKE5 Editor', 'class' => 'cke5-editor', 'data-lang' => \Cke5\Utils\Cke5Lang::getUserLang(), 'data-profile' => 'default'])
->setFull() // or ->addTextAreaField(1.2,['full' => true])
)
// add third fieldset area
->addFieldsetArea('Readonly text elements', MForm::factory() // use mform factory
// add some readonly text fields
->addTextReadOnlyField("2.0", 'string readonly', ['label' => 'Readonly Input Text'])
->addTextAreaReadOnlyField(2.1, 'string readonly', ['label' => 'Readonly Textarea'])
);
// parse form
echo $mform->show();
Clear Cobra