onlinq/form-collection-bundle 问题修复 & 功能扩展

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

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

onlinq/form-collection-bundle

最新稳定版本:0.2.1

Composer 安装命令:

composer require onlinq/form-collection-bundle

包简介

Symfony bundle to build forms with Onlinq Form Collection web components

关键字:

README 文档

README

Symfony bundle to build forms with Onlinq Form Collection web components.

It allows form collections to be manipulated through JavaScript and customizable buttons.

Installation

Onlinq Form Collection Bundle requires PHP 7.2+ and Symfony 4.4+.

Install this bundle using Composer and Symfony Flex:

composer require onlinq/form-collection-bundle

The easiest way to enable the Onlinq Form Collection web components in forms is by adding one of the built-in form themes to the project's Twig configuration:

# config/packages/twig.yaml

twig:
    form_themes:
        - '@OnlinqFormCollection/collection_theme.html.twig'

Make sure to add the Onlinq Form Collection script to pages with forms through a JavaScript bundler or by including it at the bottom of your page with:

<script src="{{ asset('bundles/onlinqformcollection/onlinq-collection.js') }}"></script>

Read on to start using the bundle immediately or visit the documentation.

Usage

The Onlinq Form Collection web components are enabled when a compatible form theme has been loaded. The easiest way to configure the resulting form collection is by using the built-in form type that can be used as a drop-in replacement for the Symfony CollectionType class:

// ...
use Onlinq\FormCollectionBundle\Form\OnlinqCollectionType;

class TaskType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            // ...
            ->add('tags', OnlinqCollectionType::class, [
                'entry_type' => TagType::class,
                'entry_options' => ['label' => false],
                'allow_add' => true,
                'allow_delete' => true,
                'allow_move' => true,
            ])
            // ...
        ;
    }

    // ...
}

Built-in form themes

The bundle includes multiple built-in form themes to make collections look great without having to create your own styling:

  • @OnlinqFormCollection/collection_theme.html.twig
  • @OnlinqFormCollection/bootstrap_4_collection_theme.html.twig
  • @OnlinqFormCollection/bootstrap_5_collection_theme.html.twig

Learn more about the built-in form themes in the documentation.

Using a JavaScript bundler

When using a bundler like Webpack it's possible to include the Onlinq Form Collection web components through the compiled JavaScript bundle.

Install the Onlinq Form Collection web components package:

npm install @onlinq/form-collection

Import the package in the project's JavaScript assets:

// assets/js/app.js

import '@onlinq/form-collection';

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: Twig

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-06