├── CHANGELOG.md ├── DependencyInjection └── IvoryOrderedFormExtension.php ├── IvoryOrderedFormBundle.php ├── LICENSE ├── README.md ├── Resources ├── config │ └── services.xml └── doc │ ├── docker.md │ ├── installation.md │ └── usage.md ├── UPGRADE.md └── composer.json /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | ### 3.0.0 (2017-02-27) 4 | 5 | * 3d820ca - [UPGRADE] Notify about PHP and Symfony bump 6 | * 1c0ea3e - [Composer] Move egeloen/ordered-form to stable 7 | * 96bfa71 - Bump Symfony to 2.7 + PHP to 5.6 + Add AppVeyor support 8 | * 2f46707 - [Docker] Add HHVM container 9 | * a816ac9 - Add docker support 10 | * 3ba963a - Add PHP-CS-Fixer support 11 | * 7ec52ca - [Composer] Update deps 12 | * 2a75fc3 - [License] Happy new year 13 | * 9829a3d - Remove coveralls 14 | 15 | ### 2.0.1 (2015-12-12) 16 | 17 | * 7acf274 - Make code base compatible with Symfony3 18 | 19 | ### 2.0.0 (2014-12-29) 20 | 21 | * cb452c0 - [Travis] Add composer prefer lowest build 22 | * 54a5019 - [Travis] Move Symfony 2.6.*@dev to 2.6.* 23 | * 3c0c16f - [Travis] Update config 24 | * 3253674 - Add .gitattributes 25 | * eff3bb8 - [Readme] Fix badge uri 26 | * 6fae432 - [DependencyInjection] Remove *.class parameters 27 | * eac9a60 - [Test] Remove bootstrap.php 28 | * bec1d71 - [Encapsulation] Move everything from protected to private (except for entry point) 29 | 30 | ### 1.1.1 (2014-11-08) 31 | 32 | * 7d0d16a - [Gitignore] Remove Composer installer and phar 33 | * bd87e4f - [README] Rely on relative link 34 | * 6c402a3 - Add contributing doc 35 | * 2a917d8 - [Composer] Refine deps 36 | 37 | ### 1.1.0 (2014-08-12) 38 | 39 | * 5c13cb6 - [Travis] Improve build matrix 40 | * a83bbd1 - [Composer] Bump egeloen/ordered-form 41 | * eb05ef7 - [Resources] Refactor services according to the library changes 42 | * 22f2738 - [README] Add versioneye badge 43 | * ffefad7 - [README] Add packagist badges 44 | * 1565454 - [Travis] Increase build matrix 45 | * 09f069a - [Composer] Bump PHP to 5.3.3 + PHPUnit to 4.0 46 | * ea1a610 - [Travis][Composer] Remove --dev 47 | * 9d4c945 - [Composer] Upgrade to PSR-4 48 | 49 | ### 1.0.2 (2014-06-17) 50 | 51 | * b4b06d8 - [Travis] Add Symfony 2.5 52 | * 64f158d - [README] Add scrutinizer CI badge 53 | * b3f88a3 - [Test] Reduce code duplication 54 | 55 | ### 1.0.1 (2014-05-16) 56 | 57 | * ff965c0 - Add coveralls support 58 | * 44f0cc1 - Update new years 59 | 60 | ### 1.0.0 (2013-12-29) 61 | 62 | * 875ec66 Extract business code in a dedicated library + Update Symfony to >= 2.3 63 | 64 | ### 0.9.2 (2013-12-12) 65 | 66 | * 7b24143 - [Travis] Simplify matrix + Add Symfony 2.4 to the build 67 | * e426180 - [OrderedResolvedFormType] Fix builder creation 68 | 69 | ### 0.9.1 (2013-10-29) 70 | 71 | * 8de6f4f - Add button support 72 | * ea10a61 - [Doc] Fix examples 73 | * 4016305 - [Doc] Fix package version 74 | * 6db7120 - [Form][Extension] Remove dead code 75 | 76 | ### 0.9.0 (2013-08-26) 77 | -------------------------------------------------------------------------------- /DependencyInjection/IvoryOrderedFormExtension.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please read the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Ivory\OrderedFormBundle\DependencyInjection; 13 | 14 | use Symfony\Component\Config\FileLocator; 15 | use Symfony\Component\DependencyInjection\ContainerBuilder; 16 | use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; 17 | use Symfony\Component\Form\AbstractType; 18 | use Symfony\Component\HttpKernel\DependencyInjection\Extension; 19 | 20 | /** 21 | * @author GeLo 22 | */ 23 | class IvoryOrderedFormExtension extends Extension 24 | { 25 | /** 26 | * {@inheritdoc} 27 | */ 28 | public function load(array $configs, ContainerBuilder $container) 29 | { 30 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); 31 | $loader->load('services.xml'); 32 | 33 | if (!method_exists(AbstractType::class, 'getBlockPrefix')) { 34 | $container->getDefinition('ivory_ordered_form.form_extension') 35 | ->clearTag($tag = 'form.type_extension') 36 | ->addTag($tag, ['alias' => 'form']); 37 | 38 | $container->getDefinition('ivory_ordered_form.button_extension') 39 | ->clearTag($tag) 40 | ->addTag($tag, ['alias' => 'button']); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /IvoryOrderedFormBundle.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please read the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Ivory\OrderedFormBundle; 13 | 14 | use Symfony\Component\HttpKernel\Bundle\Bundle; 15 | 16 | /** 17 | * @author GeLo 18 | */ 19 | class IvoryOrderedFormBundle extends Bundle 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2017 Eric GELOEN 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 4 | documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 5 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 6 | persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 9 | Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 12 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 13 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 14 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | [![Travis Build Status](https://secure.travis-ci.org/egeloen/IvoryOrderedFormBundle.png?branch=master)](http://travis-ci.org/egeloen/IvoryOrderedFormBundle) 4 | [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/4b1d64pa9fdm20mi/branch/master?svg=true)](https://ci.appveyor.com/project/egeloen/ivoryorderedformbundle/branch/master) 5 | [![Code Coverage](https://scrutinizer-ci.com/g/egeloen/IvoryOrderedFormBundle/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/egeloen/IvoryOrderedFormBundle/?branch=master) 6 | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/egeloen/IvoryOrderedFormBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/egeloen/IvoryOrderedFormBundle/?branch=master) 7 | [![Dependency Status](https://www.versioneye.com/php/egeloen:ordered-form-bundle/badge.svg)](https://www.versioneye.com/php/egeloen:ordered-form-bundle) 8 | 9 | [![Latest Stable Version](https://poser.pugx.org/egeloen/ordered-form-bundle/v/stable.svg)](https://packagist.org/packages/egeloen/ordered-form-bundle) 10 | [![Latest Unstable Version](https://poser.pugx.org/egeloen/ordered-form-bundle/v/unstable.svg)](https://packagist.org/packages/egeloen/ordered-form-bundle) 11 | [![Total Downloads](https://poser.pugx.org/egeloen/ordered-form-bundle/downloads.svg)](https://packagist.org/packages/egeloen/ordered-form-bundle) 12 | [![License](https://poser.pugx.org/egeloen/ordered-form-bundle/license.svg)](https://packagist.org/packages/egeloen/ordered-form-bundle) 13 | 14 | The bundle allows to order your Symfony2 form fields by adding the position option. A position can either be first, 15 | last or an associative array describing before and/or after field. 16 | 17 | ## Documentation 18 | 19 | 1. [Installation](/Resources/doc/installation.md) 20 | 2. [Usage](/Resources/doc/usage.md) 21 | 22 | ## Testing 23 | 24 | The bundle is fully unit tested by [PHPUnit](http://www.phpunit.de/) with a code coverage close to **100%**. To 25 | execute the test suite, check the travis [configuration](/.travis.yml). 26 | 27 | ## Contribute 28 | 29 | We love contributors! Ivory is an open source project. If you'd like to contribute, feel free to propose a PR! You 30 | can follow the [CONTRIBUTING](/CONTRIBUTING.md) file which will explain you how to set up the project. 31 | 32 | ## License 33 | 34 | The Ivory Ordered Form Bundle is under the MIT license. For the full copyright and license information, please read the 35 | [LICENSE](/LICENSE) file that was distributed with this source code. 36 | -------------------------------------------------------------------------------- /Resources/config/services.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Resources/doc/docker.md: -------------------------------------------------------------------------------- 1 | # Docker 2 | 3 | The most easy way to set up the project is to install [Docker](https://www.docker.com) and 4 | [Docker Composer](https://docs.docker.com/compose/) and build the project. 5 | 6 | ## Configure 7 | 8 | The configuration is shipped with a distribution environment file allowing you to customize your IDE and XDebug 9 | settings as well as your current user/group ID: 10 | 11 | ``` bash 12 | $ cp .env.dist .env 13 | ``` 14 | 15 | **The most important part is the `USER_ID` and `GROUP_ID` which should match your current user/group.** 16 | 17 | ## Build 18 | 19 | Once you have configured your environment, you can build the project: 20 | 21 | ``` bash 22 | $ docker-compose build 23 | ``` 24 | 25 | ## Composer 26 | 27 | Install the dependencies via [Composer](https://getcomposer.org/): 28 | 29 | ``` bash 30 | $ docker-compose run --rm php composer install 31 | ``` 32 | 33 | ## Tests 34 | 35 | To run the test suite, you can use: 36 | 37 | ``` bash 38 | $ docker-compose run --rm php vendor/bin/phpunit 39 | ``` 40 | 41 | If you want to run the test suite against [HHVM](http://hhvm.com/), you can use: 42 | 43 | ``` bash 44 | $ docker-compose run --rm hhvm vendor/bin/phpunit 45 | ``` 46 | 47 | ## XDebug 48 | 49 | If you want to use XDebug, make sure you have fully configured your `.env` file and use: 50 | 51 | ``` bash 52 | $ docker-compose run --rm -e XDEBUG=1 php vendor/bin/phpunit 53 | ``` 54 | -------------------------------------------------------------------------------- /Resources/doc/installation.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | To install the Ivory Ordered Form bundle, you will need [Composer](http://getcomposer.org). It's a PHP 5.3+ dependency 4 | manager which allows you to declare the dependent libraries your project needs and it will install & autoload them for 5 | you. 6 | 7 | ## Set up Composer 8 | 9 | Composer comes with a simple phar file. To easily access it from anywhere on your system, you can execute: 10 | 11 | ``` bash 12 | $ curl -s https://getcomposer.org/installer | php 13 | $ sudo mv composer.phar /usr/local/bin/composer 14 | ``` 15 | 16 | ## Download the bundle 17 | 18 | Require the library in your `composer.json` file: 19 | 20 | ``` bash 21 | $ composer require egeloen/ordered-form-bundle 22 | ``` 23 | 24 | ## Register the bundle 25 | 26 | Then, add the bundle in your `AppKernel`: 27 | 28 | ``` php 29 | // app/AppKernel.php 30 | 31 | public function registerBundles() 32 | { 33 | return [ 34 | // ... 35 | new Ivory\OrderedFormBundle\IvoryOrderedFormBundle(), 36 | ]; 37 | } 38 | ``` 39 | -------------------------------------------------------------------------------- /Resources/doc/usage.md: -------------------------------------------------------------------------------- 1 | # Usage 2 | 3 | The bundle adds a new option called `position` on all forms! You can get the full documentation 4 | [here](https://github.com/egeloen/ivory-ordered-form/blob/master/doc/usage.md#position). 5 | 6 | ## Known limitations 7 | 8 | Some use cases can not be handled by the bundle. They are listed 9 | [here](https://github.com/egeloen/ivory-ordered-form/blob/master/doc/known_limitations.md). 10 | -------------------------------------------------------------------------------- /UPGRADE.md: -------------------------------------------------------------------------------- 1 | # UPGRADE 2 | 3 | ### 2.0 to 3.0 4 | 5 | * PHP has been bumped to 5.6. 6 | * Symfony has been bumped to 2.7. 7 | 8 | ### 1.1 to 2.0 9 | 10 | * All protected properties and methods have been updated to private except for entry points. This is mostly motivated 11 | for enforcing the encapsulation and easing backward compatibility. The same goes for the library. 12 | 13 | ### 1.0 to 1.1 14 | 15 | The `ivory_ordered_form.form_orderer_factory` service and `ivory_ordered_form.form_orderer_factory.class` parameter has 16 | been removed according to the changes done in the library. It has been replaced by the `ivory_ordered_form.form_orderer` 17 | service and `ivory_ordered_form.form_orderer.class` parameter. 18 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egeloen/ordered-form-bundle", 3 | "type": "symfony-bundle", 4 | "description": "Provides a form ordering support for your Symfony2 project.", 5 | "keywords": [ "form", "order" ], 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Eric GELOEN", 10 | "email": "geloen.eric@gmail.com" 11 | } 12 | ], 13 | "require": { 14 | "php": "^5.6|^7.0", 15 | "symfony/framework-bundle": "^2.7|^3.0", 16 | "egeloen/ordered-form": "^3.0" 17 | }, 18 | "require-dev": { 19 | "friendsofphp/php-cs-fixer": "^2.0", 20 | "phpunit/phpunit": "^5.0", 21 | "symfony/phpunit-bridge": "^2.7|^3.0" 22 | }, 23 | "autoload": { 24 | "psr-4": { "Ivory\\OrderedFormBundle\\": "" } 25 | }, 26 | "extra": { 27 | "branch-alias": { 28 | "dev-master": "3.0-dev" 29 | } 30 | } 31 | } 32 | --------------------------------------------------------------------------------