ckeditor.api.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @file
  4. * Documentation for CKEditor module APIs.
  5. */
  6. use Drupal\editor\Entity\Editor;
  7. /**
  8. * @addtogroup hooks
  9. * @{
  10. */
  11. /**
  12. * Modify the list of available CKEditor plugins.
  13. *
  14. * This hook may be used to modify plugin properties after they have been
  15. * specified by other modules.
  16. *
  17. * @param $plugins
  18. * An array of all the existing plugin definitions, passed by reference.
  19. *
  20. * @see \Drupal\ckeditor\CKEditorPluginManager
  21. */
  22. function hook_ckeditor_plugin_info_alter(array &$plugins) {
  23. $plugins['someplugin']['label'] = t('Better name');
  24. }
  25. /**
  26. * Modify the list of CSS files that will be added to a CKEditor instance.
  27. *
  28. * Modules may use this hook to provide their own custom CSS file without
  29. * providing a CKEditor plugin. This list of CSS files is only used in the
  30. * iframe versions of CKEditor.
  31. *
  32. * Front-end themes (and base themes) can easily specify CSS files to be used in
  33. * iframe instances of CKEditor through an entry in their .info.yml file:
  34. *
  35. * @code
  36. * ckeditor_stylesheets:
  37. * - css/ckeditor-iframe.css
  38. * @endcode
  39. *
  40. * @param array &$css
  41. * An array of CSS files, passed by reference. This is a flat list of file
  42. * paths which can be either relative to the Drupal root or external URLs.
  43. * @param $editor
  44. * The text editor object as returned by editor_load(), for which these files
  45. * are being loaded. Based on this information, it is possible to load the
  46. * corresponding text format object.
  47. *
  48. * @see _ckeditor_theme_css()
  49. */
  50. function hook_ckeditor_css_alter(array &$css, Editor $editor) {
  51. $css[] = drupal_get_path('module', 'mymodule') . '/css/mymodule-ckeditor.css';
  52. }
  53. /**
  54. * @} End of "addtogroup hooks".
  55. */