2017 © Pedro PelĂĄez
 

symfony-bundle dynamic-form-bundle

Symfony2 From generator from array description

image

acseo/dynamic-form-bundle

Symfony2 From generator from array description

  • Thursday, July 20, 2017
  • by dev-acseo
  • Repository
  • 13 Watchers
  • 4 Stars
  • 577 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 16 % Grown

The README.md

Getting Started With ACSEODynamicFormBundle

Installation

  1. Download ACSEODynamicFormBundle using composer
  2. Enable the Bundle
  3. Controller example
  4. Create your own provider

Step 1: Download ACSEODynamicFormBundle using composer

Add ACSEODynamicFormBundle in your composer.json:, (*1)

{   
    "require": {
        "acseo/dynamic-form-bundle": "dev-master"
    }
}

Now tell composer to download the bundle by running the command:, (*2)

``` bash $ composer update acseo/dynamic-form-bundle, (*3)


Composer will install the bundle to your project's `vendor/acseo` directory. ### Step 2: Enable the bundle Enable the bundle in the kernel: ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new ACSEO\Bundle\DynamicFormBundle\ACSEODynamicFormBundle(), ); }

Step 3: Controller example

``` php, (*4)

public function indexAction() { $formArray = array( 'name' => array( 'type' => 'text', 'options' => array( 'label' => 'Nom', 'help' => 'Renseignez votre nom', 'picto' => 'text', ), 'constraints' => array( 'NotBlank' => true, 'Length' => array('min' => 2), ) ), 'amount' => array( 'type' => 'money', 'options' => array( 'label' => 'Montant TTC', 'help' => 'Montant total de votre achat', 'picto' => 'money', ), 'constraints' => array( 'NotBlank' => true ) ), 'buydate' => array( 'type' => 'date', 'options' => array( 'label' => "Date d'achat", 'picto' => 'date', ), 'constraints' => array( 'NotBlank' => true ) ), 'product' => array( 'type' => 'text', 'options' => array( 'label' => 'Libellé produit', 'picto' => 'text', 'help' => 'lorem ipsum', 'data' => array( array('value' => 'Foo'), array('value' => 'Bar') ) ), 'constraints' => array( 'NotBlank' => true ), 'multiple' => true ), );, (*5)

$arrayFormProvider = $this->get('acseo.form.array.provider');
$arrayFormProvider->setFormArray($formArray);

$form =  $this->get('acseo.form.manager')->createForm($arrayFormProvider);

if ($this->container->get('request')->isMethod('POST')) {
    $form->handleRequest($this->container->get('request'));

    if ($form->isValid()) {


        $data = $form->getData();
        // do anything you want ...
    }
}


return array('form' => $form->createView());

}, (*6)


### Step 4: Create your own provider You can create your own service form provider that implements FormProviderInterface. ### Step 5: Exemple of JS to implement in your project ```js

The Versions

20/07 2017

v2.8.x-dev

2.8.9999999.9999999-dev https://github.com/acseo/DynamicFormBundle

Symfony2 From generator from array description

  Sources   Download

The Requires

 

by Hubert MARIN

form generator symfony

20/07 2017

v2.8.1

2.8.1.0 https://github.com/acseo/DynamicFormBundle

Symfony2 From generator from array description

  Sources   Download

The Requires

 

by Hubert MARIN

form generator symfony

20/07 2017

dev-master

9999999-dev https://github.com/acseo/DynamicFormBundle

Symfony2 From generator from array description

  Sources   Download

The Requires

 

by Hubert MARIN

form generator symfony

05/08 2015

v2.8.0

2.8.0.0 https://github.com/acseo/DynamicFormBundle

Symfony2 From generator from array description

  Sources   Download

The Requires

 

by Hubert MARIN

form generator symfony