2017 © Pedro PelĂĄez
 

symfony-bundle auto-form-bundle

Automate form building

image

a2lix/auto-form-bundle

Automate form building

  • Tuesday, April 3, 2018
  • by a2lix
  • Repository
  • 3 Watchers
  • 7 Stars
  • 35,360 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 5 Versions
  • 26 % Grown

The README.md

A2lix Auto Form Bundle

Automate form building., (*1)

Latest Stable Version Latest Unstable Version License, (*2)

Total Downloads Monthly Downloads Daily Downloads, (*3)

Branch Tools
master Build Status Coverage Status

Installation

Use composer:, (*4)

composer require a2lix/auto-form-bundle

After the successful installation, add/check the bundle registration:, (*5)

//  bundles.php is automatically updated if flex is installed.
// ...
A2lix\AutoFormBundle\A2lixAutoFormBundle::class => ['all' => true],
// ...

Configuration

There is no minimal configuration, so this part is optional. Full list:, (*6)

# Create a dedicated a2lix.yaml in config/packages with:

a2lix_auto_form:
    excluded_fields: [id, locale, translatable]       # [1]
  1. Optional.

Usage

In a classic formType

use A2lix\AutoFormBundle\Form\Type\AutoFormType;
...
$builder->add('medias', AutoFormType::class);

Advanced examples

use A2lix\AutoFormBundle\Form\Type\AutoFormType;
...
$builder->add('medias', AutoFormType::class, [
    'fields' => [                               // [2]
        'description' => [                         // [3.a]
            'field_type' => 'textarea',                // [4]
            'label' => 'descript.',                    // [4]
            'locale_options' => [                  // [3.b]
                'es' => ['label' => 'descripciĂłn']     // [4]
                'fr' => ['display' => false]           // [4]
            ]
        ]
    ],
    'excluded_fields' => ['details']            // [2]
]);
  1. Optional. If set, override the default value from config.yml
  2. Optional. If set, override the auto configuration of fields
    • [3.a] Optional. - For a field, applied to all locales
    • [3.b] Optional. - For a specific locale of a field
  3. Optional. Common options of symfony forms (max_length, required, trim, read_only, constraints, ...), which was added 'field_type' and 'display'

Additional

Example

See Demo Bundle for more examples., (*7)

Contribution help

docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) composer install --ignore-platform-reqs
docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) composer run-script phpunit
docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) composer run-script cs-fixer

License

This package is available under the MIT license., (*8)

The Versions

19/03 2018
10/08 2016

0.1-beta.1

0.1.0.0-beta1 https://github.com/a2lix/AutoFormBundle

Automatize form creation

  Sources   Download

MIT

The Requires

 

The Development Requires

form symfony2 magic field automatize automatization