This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (2.0.0) of this package.

Extension for Nette forms

2.0.0 2016-09-07 19:22 UTC

This package is not auto-updated.

Last update: 2017-07-18 08:24:09 UTC


README

Build Status

Installation

Neon

extensions:
    form: WebChemistry\Forms\DI\FormsExtension
    
form:
    factories:
    	front: WebChemistry\Forms\Factory\DefaultFormFactory

Faster containers


class ExampleForm extends WebChemistry\Forms\Control {

    public function createMyForm() {
        $form = $this->createForm();
        
        $form->addText('text', 'Text');
        
        $form->addText('container.text', 'Text');
        $form->addText('container.textTwo', 'Text two');
        
        $form->addContainer('container')->addText('container.text', 'Text');
        $form->addText('container.container.textTwo', 'Text two');
        
        unset($form['container.text']);
        isset($form['container.text']); /
        
        return $form;
    }
}

Reusable forms with WebChemistry\Forms\Control

Control:


class ExampleForm extends WebChemistry\Forms\Control {

    public function createMyForm() {
        $form = $this->createForm(); // Returns form by module from Application or default, if module not set

        $form->addText('text', 'Text');

        return $form;
    }

}

Presenter:

class FooPresenter extends Nette\Application\UI\Presenter {

    /** @var ExampleForm */
    private $exampleForm;

    public function __construct(ExampleForm $exampleForm) {
        $this->exampleForm = $exampleForm;
    }

    public function createComponentForm() {
        return $this->exampleForm->createMyForm();
    }

}

Custom factories

config:

form:
	factories:
		front: FrontFactory # for FrontModule
		admin: AdminFactory # for AdminModule