popov/zfc-form

ZF2 form management

Installs: 171

Dependents: 1

Suggesters: 0

Security: 0

Stars: 3

Watchers: 3

Forks: 0

Open Issues: 0

Type:zf-module

dev-master 2019-03-18 14:10 UTC

This package is auto-updated.

Last update: 2024-04-07 02:04:58 UTC


README

Features:

  • registered AbstractFactory which allow create most of Form without factory declaration;
  • auto resolving for DoctrineHydrator and Translator;
  • twitter bootstrap template rendering (only html template without core override);
  • save Form with Ajax;
  • Add/Remove buttons for dynamic elements.

Usage

Form can be rendered in template as <?= $this->partial('form::form', ['form' => $form]) ?>. Or in action as return (new ViewModel(['form' => $form])->setTemplate('form::form').

Custom options

  • inline

This option will try to render $fieldset's elements inline one by one with col-sm-* class.

$fieldset->add([
    'name' => $name,
    'type' => Fieldset::class,
    'options' => [
        'inline' => true,
    ],
]);
  • column

This option will take number of columns for element.

$element = $fieldset->add([
    'name' => 'value',
    'type' => 'text',
    'options' => [
        'column' => 6,
    ],
]);

Collection