PHP code example of contributte / forms-bootstrap

1. Go to this page and download the library: Download contributte/forms-bootstrap 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/ */

    

contributte / forms-bootstrap example snippets


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

BootstrapForm::switchBootstrapVersion(Enums\BootstrapVersion::V5)
$form = new BootstrapForm;

DateTimeFormat::D_DMY_DOTS_NO_LEAD

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

DateInput::$defaultFormat = DateTimeFormat::D_DMY_DOTS_NO_LEAD;
DateTimeInput::$defaultFormat = DateTimeFormat::D_DMY_DOTS_NO_LEAD . ' ' . DateTimeFormat::T_24_NO_LEAD;

DateInput::$additionalHtmlClasses = 'datepicker';
DateTimeInput:$additionalHtmlClasses = 'datetimepicker';

$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}