PHP code example of czubehead / bootstrap-4-forms

1. Go to this page and download the library: Download czubehead/bootstrap-4-forms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

czubehead / bootstrap-4-forms example snippets


$form = new BootstrapForm;
$form->renderMode = RenderMode::Vertical;		

DateTimeFormat::D_DMY_DOTS_NO_LEAD . ' ' . DateTimeFormat::T_24_NO_LEAD

[
    'sub' => [
        1 => 'opt1',
        2 => 'opt2'
    ],
    3     => 'opt3',
]

$row = $form->addRow();
$row->addCell(6)
    ->addText('firstname', 'First name');
$row->addCell(6)
    ->addText('surname', 'Surname');

$this->template->addFilter('formPair', function ($control) {
    /** @var BootstrapRenderer $renderer */
    $renderer = $control->form->renderer;
    $renderer->attachForm($control->form);

    return $renderer->renderPair($control);
});

{$form['firstname']|formPair|noescape}