2017 © Pedro Peláez
 

symfony-bundle form-bundle

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

image

symfony2admingenerator/form-bundle

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  • Friday, December 29, 2017
  • by cedriclombardot
  • Repository
  • 7 Watchers
  • 3 Stars
  • 10,897 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 14 Versions
  • 6 % Grown

The README.md

FormBundle

This bundle introduces new twig blocks: form_js, form_js_prototype and form_css., (*1)

These blocks seperate form type's HTML structure from CSS decorating the form and JS enhancing its functionalities. Also, the JS block includes form_js_prototype block, which holds any initialization logic, which should be called when adding a new field of that type., (*2)

If used properly, they make embeding collections of JS-enhanced form types very easy., (*3)

1. Installation

1.1 Add dependency to your composer.json:

"require": {
    "symfony2admingenerator/form-bundle": "@stable"
}

And run composer update in your project root directory., (*4)

1.2 Enable the bundle in your AppKernel.php:

<?php
// AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Admingenerator\FormBundle\AdmingeneratorFormBundle(),
    );
}
?>

2. Usage

This bundle adds new twig blocks for your form. In Symfony2 for form type aliased my_form you have one block my_form_widget where you put everything related to your form type. And that's totally fine for default Symfony2 form types, as they include only basic form elements., (*5)

To introduce nice GUI form widgets, we need to style them with CSS and enhance their functionality with JS. So, for these purposes, this bundle introduces new blocks. In our example, that would be my_form_css and my_form_js., (*6)

Javascript enhanced forms in collections

To make implementing add/remove items to collection of forms easier, we've also added a javascript prototype block, which resides inside the form javascript block. Example:, (*7)

```html+django {% block my_form_js %}, (*8)

{% endblock %}, (*9)


This way we've seperated the javascript selector code from widget initialization code, which now can be used in our collection widget: ```html+django {% block my_collection_form_js %} {% endblock %}

Note: this snippet does not include code to add new item, as this is already covered by How to Embed a Collection of Forms cookbook., (*10)

For example usage study the AdmingeneratorFormExtensionsBundle (templates in Resources/views/Form directory)., (*11)

3. Acknowledgements

The twig extension is copied from GenemuFormBundle. The names of twig blocks have been changed to not cause conflicts., (*12)

The bundle is great, however for our purposes, we only need the Twig Extension, so we decided to extract it and put it into a seperate bundle., (*13)

4. Versioning

Releases will be numbered with the format major.minor.patch., (*14)

And constructed with the following guidelines., (*15)

  • Breaking backwards compatibility bumps the major.
  • New additions without breaking backwards compatibility bumps the minor.
  • Bug fixes and misc changes bump the patch.

For more information on SemVer, please visit semver.org website., (*16)

5. Contributing

This bundle follows branching model described in A successful git branching model blog post by Vincent Driessen., (*17)

  • The master branch is used to tag stable releases.
  • The develop branch is used to develop small changes and merge feature branches into it.
  • The feature- branches are used to develop features. When ready, submit a PR to develop branch.
  • The hotfixes branch is used to develop fixes to severe bugs in stable releases. When ready, the fix is merged both to develop and master branches.
  • The release branches (eg. 1.1) are created for each minor release and only patches will be merged into them.

Branching model, (*18)

6. License

This bundle is released under the MIT License except for the file: Resources/doc/branching-model.png by Vincent Driessen, which is released under Creative Commons BY-SA., (*19)

The Versions

29/12 2017

dev-master

9999999-dev

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

29/12 2017

v1.5.0

1.5.0.0

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

31/08 2017

v1.4.0

1.4.0.0

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

06/01 2016

v1.3.0

1.3.0.0

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

04/01 2016

v1.2.3

1.2.3.0

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

08/04 2015

v1.2.1

1.2.1.0

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

08/04 2015

1.2.x-dev

1.2.9999999.9999999-dev

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

08/04 2015

dev-develop

dev-develop

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

08/04 2015

v1.2.0

1.2.0.0

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

08/09 2014

v1.1.0

1.1.0.0

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

08/09 2014

1.1.x-dev

1.1.9999999.9999999-dev

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

03/09 2014

1.0.x-dev

1.0.9999999.9999999-dev

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

02/09 2014

v1.0.1

1.0.1.0

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski

22/08 2014

v1.0.0

1.0.0.0

Twig extension introduceing new blocks to seperate form HTML structure from CSS decorating it and JS enhancing it's functionalities.

  Sources   Download

MIT

The Requires

 

by Piotr Gołębiewski