footnotes_wysiwyg.module 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * @file
  4. * WYSIWYG support for the footnotes module.
  5. * Currently this supports TinyMCE and CKEditor via the WYSIWYG module and
  6. * CKEditor via the CKEditor module.
  7. */
  8. /**
  9. * Implementation of hook_wysiwyg_plugin().
  10. */
  11. function footnotes_wysiwyg_wysiwyg_plugin($editor, $version) {
  12. $plugin = array(
  13. 'footnotes' => array(
  14. 'buttons' => array('footnotes' => t('Add Footnote')),
  15. 'basePath' => base_path(),
  16. // This is required to auto-load the plugin.
  17. 'load' => TRUE,
  18. ),
  19. );
  20. switch ($editor) {
  21. case 'tinymce':
  22. $plugin['footnotes']['filename'] = 'editor_plugin.js';
  23. $plugin['footnotes']['path'] = drupal_get_path('module', 'footnotes_wysiwyg') . '/tinymce_plugin/';
  24. $plugin['footnotes']['extended_valid_elements'] = array('fn');
  25. return $plugin;
  26. case 'ckeditor':
  27. // For CKEditor, path is the directory and the .js file must be called 'plugin.js'.
  28. $plugin['footnotes']['path'] = drupal_get_path('module', 'footnotes_wysiwyg') . '/ckeditor_plugin/';
  29. return $plugin;
  30. }
  31. }
  32. /**
  33. * Implements hook_ckeditor_plugin().
  34. *
  35. * Register the CKEditor plugin for the CKEditor module.
  36. */
  37. function footnotes_wysiwyg_ckeditor_plugin() {
  38. return array(
  39. 'footnotes' => array(
  40. 'name' => 'footnotes',
  41. 'desc' => t('Add Footnotes'),
  42. 'path' => drupal_get_path('module', 'footnotes_wysiwyg') . '/ckeditor_plugin/',
  43. 'buttons' => array(
  44. 'footnotes' => array(
  45. 'icon' => 'images/footnotes.png',
  46. 'label' => 'Footnotes',
  47. )
  48. ),
  49. )
  50. );
  51. }