astina / quill-bundle
此包已被弃用,不再维护。没有建议的替代包。
Symfony 2 插件,集成 Quill 编辑器作为表单类型。
dev-master
2017-08-30 13:47 UTC
Requires
- symfony/symfony: ~2.3
This package is not auto-updated.
Last update: 2018-01-26 15:23:23 UTC
README
Symfony 2 插件,集成 Quill 编辑器作为表单类型。
安装
步骤 1: 添加到 composer.json
"require": { "astina/quill-bundle":"dev-master", }
步骤 2: 启用插件
在内核中启用插件
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Astina\Bundle\QuillBundle\AstinaQuillBundle(), ); }
步骤 3: 配置插件
如有需要,更改默认配置值
# app/config/config.yml astina_quill: quill_url: bundles/astinaquill/js/quill.min.js toolbar_template: 'AstinaQuillBundle:Editor:toolbar.html.twig' theme: snow
注意:确保在您希望使用编辑器的页面中加载了正确的主题 CSS 文件。
<head> <link rel="stylesheet" href="{{ asset('bundles/astinaquill/css/themes/quill.snow.css') }}" /> </head>
使用方法
此插件为您的表单类添加了一个名为 "quill" 的表单类型
public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('content', 'quill'); }
所有插件配置选项也可以用于单个字段
$builder->add('content', 'quill', array( 'toolbar_template': 'AcmeFooBundle::toolbar_template.html.twig', );