kitlabs / kit-form-bundle
在Symfony中轻松使用UEditor、UMEditor、laydate
v1.0.0
2023-08-04 09:00 UTC
Requires
- php: >=5.5.9
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官方文档