backender / epiceditor-bundle
Symfony2 扩展包,用于轻松集成 EpicEditor
dev-master
2013-02-08 22:10 UTC
Requires
- php: >=5.3.0
- symfony/form: 2.1.*
- symfony/framework-bundle: 2.*,<2.3
- twig/twig: >=1.1,<2.0-dev
This package is not auto-updated.
Last update: 2024-09-28 14:01:43 UTC
README
此扩展包为您的 Symfony2 项目提供了 EpicEditor 集成功能。它简单地将表单字段类型 epiceditor
添加到表单组件。
有关 EpicEditor 的更多信息,请参阅:http://oscargodson.github.com/EpicEditor/
安装
- 将 BackenderEpiceditorBundle 添加到您的 composer.json
- 启用扩展包
- 安装扩展包资源
- 配置扩展包(可选)
- 将编辑器添加到表单
第 1 步:将 BackenderEpiceditorBundle 添加到您的 composer.json
{ "require": { "Backender/epiceditor-bundle": "*" } }
更新项目依赖项
php composer.phar update Backender/epiceditor-bundle
第 2 步:启用扩展包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Backender\EpiceditorBundle\BackenderEpiceditorBundle(), ); }
第 3 步:安装扩展包资源
$ php ./app/console assets:install web --symlink
--symlink 是可选的
第 4 步:配置扩展包(可选)
要获取完整的配置转储,请使用
$ php ./app/console config:dump-reference BackenderEpiceditorBundle
一个示例配置
backender_epiceditor: class: Backender\EpiceditorBundle\Form\Type\EpiceditorType container: epiceditor basepath: /web/bundles/backenderepiceditor clientSideStorage: true localStorageName: epiceditor parser: marked focusOnLoad: false file: name: epiceditor defaultContent: autoSave: 100 theme: base: /themes/base/epiceditor.css preview: /themes/preview/github.css editor: /themes/editor/epic-dark.css shortcut: modifier: 18 fullscreen: 70 preview: 80 edit: 79
或者在 FormBuilder 中覆盖配置(见第 5 步)。
第 5 步:将编辑器添加到表单
示例表单
<?php $form = $this->createFormBuilder($post) ->add('content', 'epiceditor', array( 'container' => 'epiceditor', 'basepath' => '/~marc/blog/web/bundles/backenderepiceditor', 'clientSideStorage' => true, 'localStorageName' => 'epiceditor', 'parser' => 'marked', 'focusOnLoad' => false, 'file' => array( 'name' => 'epiceditor', 'defaultContent' => '', 'autoSave' => 100 ), 'theme' => array( 'base' => '/themes/base/epiceditor.css', 'preview' => '/themes/preview/github.css', 'editor' => '/themes/editor/epic-dark.css' ), 'shortcut' => array( 'modifier' => 18, 'fullscreen' => 70, 'preview' => 80, 'edit' => 79 ) )) ->getForm() ;
注意:所有来自 config.yml 的参数都可以在表单中重写(除了 class
)。
##贡献
如果扩展包不允许您自定义某个选项,我邀请您分支项目,创建一个功能分支,并发送拉取请求。
为了确保代码库的一致性,您应确保代码遵循 编码标准。
##许可证
此扩展包受 MIT 许可证的约束。查看完整的许可证 此处。
下一步
- 测试即将到来