kitlabs/kit-form-bundle

在Symfony中轻松使用UEditor、UMEditor、laydate

安装次数: 1,961

依赖者: 0

建议者: 0

安全: 0

星标: 4

关注者: 3

分支: 0

开放问题: 0

语言:JavaScript

类型:symfony-bundle

v1.0.0 2023-08-04 09:00 UTC

This package is not auto-updated.

Last update: 2024-09-13 15:48:40 UTC


README

FulltextType(UEditor, UMEditor), LaydateType

安装

步骤 1: 下载Bundle

打开命令行,进入项目目录并执行以下命令以下载此Bundle的最新稳定版本

$ composer require kitlabs/kit-form-bundle

此命令要求您全局安装Composer,如Composer文档中的安装章节所述。

步骤 2: 启用Bundle

然后,将Bundle添加到项目app/AppKernel.php文件中注册的Bundle列表中,以启用该Bundle

<?php
// app/AppKernel.php
 
// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
 
            new Kit\FormBundle\KitFormBundle(),
        );
 
        // ...
    }
 
    // ...
}

步骤 3: 配置

# config.yml
# Twig Configuration
twig:
    ...
    form_themes:
        - 'KitFormBundle:Form:kit_form_theme.html.twig'

使用方法

  • LayDateType
    引入laydate.js或者使用layui框架。

      <script src="{{ asset('public/laydate/laydate.js') }}"></script>
    

    在buildForm中使用:

      $builder-->add('start_time', LayDateType::class, [
          'label' => '开始时间',
          'type' => 'time'
      ])->add('end_time', LayDateType::class, [
          'label' => '结束时间',
          'type' => 'time'
      ]);
    

    PS: 详细配置请阅读layDate官方文档