定制 wandi/ordered-form 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wandi/ordered-form

Composer 安装命令:

composer require wandi/ordered-form

包简介

Provides a form ordering support with the Symfony2 form component.

README 文档

README

Travis Build Status AppVeyor Build status Code Coverage Scrutinizer Code Quality Dependency Status

Latest Stable Version Latest Unstable Version Total Downloads License

The library allows to order your Symfony2 form fields by adding the position option. A position can either be first, last or an associative array describing before and/or after field.

Wandi Note

Note: this is a Symfony 4 Fork

If you want to use this Bundle with the Symfony Framework Standard Edition and use the CreateForm method in a Controller that extends Symfony\Bundle\FrameworkBundle\Controller\AbstractController, follow this quick guide:

// config/services.yaml
Symfony\Component\Form\FormExtensionInterface: "@form.extension"

Before (classic case):

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class YourController extends AbstractController
{
    // [...]
    
    public function __construct(/* DI */)
    {
        // [...]
    }
    
    public function yourAction(Request $request): Response
    {
        $yourEntity = new Entity();
        
        $form = $this->createForm(YourType::class, $yourEntity, [
            // your options
        ]);
        $form->handleRequest($request);
        
         // [...]
    }
}

After:

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Form\FormExtensionInterface;
use Ivory\OrderedForm\Extension\OrderedExtension;
use Symfony\Component\Form\Forms;
use Ivory\OrderedForm\OrderedResolvedFormTypeFactory;

class YourController extends AbstractController
{
    /**
     * @var FormExtensionInterface
     */
    private $formExtension;
    
    public function __construct(FormExtensionInterface $formExtension)
    {
        $this->formExtension = $formExtension;
    }
    
    public function yourAction(Request $request): Response
    {
        $yourEntity = new Entity();
        
        $formFactory = Forms::createFormFactoryBuilder()
            ->setResolvedTypeFactory(new OrderedResolvedFormTypeFactory())
            ->addExtension($this->formExtension)
            ->addExtension(new OrderedExtension())
            ->getFormFactory();
        $form = $formFactory->create(YourType::class, $yourEntity, [
            // your options
        ]);
        $form->handleRequest($request);
        
         // [...]
    }
}

Documentation

  1. Installation
  2. Usage
  3. Known limitations

Testing

The library is fully unit tested by PHPUnit with a code coverage close to 100%. To execute the test suite, check the travis configuration.

Contribute

We love contributors! Ivory is an open source project. If you'd like to contribute, feel free to propose a PR! You can follow the CONTRIBUTING file which will explain you how to set up the project.

License

The Ivory Ordered Form is under the MIT license. For the full copyright and license information, please read the LICENSE file that was distributed with this source code.

统计信息

  • 总下载量: 17
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固