aipng / forms
Reusable form control.
1.0
2025-03-07 15:00 UTC
Requires
- php: >=8.3
- latte/latte: ^v3.0
- nette/application: ^v3.2
- nette/forms: ^v3.2
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpstan/phpstan-nette: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^12.0
README
"Form as a component" control. Form should be defined in createComponentForm
method.
Simple structure:
/my-app/src/
templates/MyForm.latte
MyForm.php
MyForm.latte
MyForm.latte - customized form template (when needed)
{form form} manual rendering of form controls ... {/form}
MyForm.php
final class MyForm extends \AipNg\Forms\BaseFormControl { public function createComponentForm(): \Nette\Application\UI\Form { $form = ... return $form; } }
Usage in presenter
// in presenter class MyPresenter public function createComponentMyForm() { return new MyForm; } public function actionEdit() { $this['myForm']->setDefaults([ ... ]); }
Latte
Input description macro helps to show control's description in template when using manual rendering.
Register in config.neon:
latte: extensions:: - AipNg\Latte\FormInputDescriptionExtension
Just use anywhere in form template
{inputDescription $controlName}