Skip to content
Aleš edited this page Jun 20, 2018 · 3 revisions

Basic usage

You can use renderer as classic renderer in form factory:

$form = new Nette\Application\UI\Form;
$form->setRenderer(new AlesWita\FormRenderer\BootstrapV4Renderer);

..or you can use prepared factory:

services:
	- AlesWita\FormRenderer\Factory(@Nette\Localization\ITranslator)
	- App\Components\Forms\MyForm(@AlesWita\FormRenderer\Factory)
final class MyForm extends Nette\Application\UI\Control
{
	/** @var AlesWita\FormRenderer\Factory */
	private $factory;


	/**
	 * @param AlesWita\FormRenderer\Factory
	 */
	public function __construct(AlesWita\FormRenderer\Factory $factory)
	{
		$this->factory = $factory;
	}


	/**
	 * @return Nette\Application\UI\Form
	 */
	public function create(): Nette\Application\UI\Form
	{
		$form = $this->factory->create();

		...

		return $form;
	}
}

Features

BootstrapV4Renderer convert your forms to Bootstrap V4 design.

Renderer support:

  • form errors
  • groups
  • groups description
  • input errors
  • input description
  • input addons (left, right, both or multiple addons)
$form->addText('text1', 'Label:')
	->setOption('left-addon', 'addon text');

$form->addText('text2', 'Label:')
	->setOption('right-addon', ['addon', 'text']);
Clone this wiki locally
You can’t perform that action at this time.