plugin.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. Plugin support
  2. ==============
  3. The bundle offers you the ability to manage extra plugins. To understand how it
  4. works, you will enable the `Wordcount`_ plugin for our CKEditor widget.
  5. Install the Plugin
  6. ------------------
  7. First, you need to download and extract it in the web directory. For that, you
  8. have two possibilities:
  9. #. Directly put the plugin in the web directory (``/web/ckeditor/plugins/`` for
  10. example).
  11. #. Put the plugin in the ``/Resources/public/`` directory of any of your bundles.
  12. Register the Plugin
  13. -------------------
  14. In order to load it, you need to specify its location. For that, you can do it
  15. globally in your configuration:
  16. .. code-block:: yaml
  17. # app/config/config.yml
  18. fos_ck_editor:
  19. default_config: my_config
  20. configs:
  21. my_config:
  22. extraPlugins: "wordcount"
  23. plugins:
  24. wordcount:
  25. path: "/bundles/mybundle/wordcount/" # with trailing slash
  26. filename: "plugin.js"
  27. Or you can do it in your widget:
  28. .. code-block:: php
  29. $builder->add('field', 'ckeditor', array(
  30. 'config' => array(
  31. 'extraPlugins' => 'wordcount',
  32. ),
  33. 'plugins' => array(
  34. 'wordcount' => array(
  35. 'path' => '/bundles/mybundle/wordcount/', // with trailing slash
  36. 'filename' => 'plugin.js',
  37. ),
  38. ),
  39. ));
  40. Plugin dependency
  41. -----------------
  42. Once your plugin is installed and registered, you will also need to install and
  43. register these dependencies. Hopefully, the ``wordcount`` has no extra dependency
  44. but other plugin can require extra ones. So if it is the case, you need to redo
  45. the process for them and so on.
  46. Plugin icon
  47. -----------
  48. If you don't configure a built-in toolbar or a custom toolbar, the plugin icon
  49. should be visible automatically according to the plugin configuration otherwise,
  50. it is your responsibility to configure it. Take a look to this
  51. :doc:`documentation <toolbar>`.
  52. .. _`Wordcount`: http://ckeditor.com/addon/wordcount