idci/extra-form-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

idci/extra-form-bundle

最新稳定版本:v6.0.0

Composer 安装命令:

composer require idci/extra-form-bundle

包简介

Symfony bundle that expand existing FormType feature to allow a dynamic form generation

README 文档

README

ExtraFormBundle is a Symfony bundle that expand existing FormType features to allow dynamic forms generation.

This bundle provide:

  • A builder to generate forms from a configuration array. This allow you to configure your forms in any format convertible in an array (yaml, json, etc) and dynamically generate your forms.
  • A set of extra types (iban, captcha..) ready to use.
  • An api that exposes all symfony form types as 'extra form types'
  • An api that exposes all symfony validation constraints as 'extra form constraints'

SensioLabsInsight Build

Installation

Install this bundle using composer:

$ php composer require idci/extra-form-bundle:dev-master

Import the bundle configuration:

# app/config/config.yml

imports:
    - { resource: '@IDCIExtraFormBundle/Resources/config/config.yml' }

That's it, you are ready to use the extra form builder.

Use the editor

If you need the api or the editor:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FOS\RestBundle\FOSRestBundle(),
        new JMS\SerializerBundle\JMSSerializerBundle(),
    );
}

Enable the serializer:

# app/config/config.yml

fos_rest:
    param_fetcher_listener: true # if you want to add configured types
    service:
        serializer: jms_serializer.serializer

Import the routes:

# app/config/routing.yml
extra_form:
    resource: "@IDCIExtraFormBundle/Controller/"
    type: annotation

Install the assets:

php bin/console assets:install --symlink

The editor requires bootstrap and jquery. If you don't use it already in your project, just add the following lines in your views.

{% block javascripts %}
    {{ parent() }}
    <script type="text/javascript" src="{{ asset('bundles/idciextraform/js/vendor/jquery-2.2.4.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('bundles/idciextraform/js/vendor/bootstrap.min.js') }}"></script>
{% endblock %}

{% block stylesheets %}
    {{ parent() }}
    <link rel="stylesheet" type="text/css" href="{{ asset('bundles/idciextraform/css/bootstrap.min.css') }}" />
    <link rel="stylesheet" type="text/css" href="{{ asset('bundles/idciextraform/css/bootstrap-theme.min.css') }}" />
{% endlbock %}

Use the configured types

You can register configured types via the editor. It allows you to access types with pre-configured fields.

Register doctrine bundle in your application kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
    );
}

Then update the doctrine schema. It will create a table to register the configured types in database.

doctrine:schema:update --force

Documentation

Going further

Tests

We use docker and docker-compose to run the tests, along with a Makefile.

Install the bundle dev dependencies:

$ make composer-update

To execute unit tests:

$ make phpunit

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 11
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-27