You are here

function footnotes_wysiwyg_wysiwyg_plugin in Footnotes 6.2

Same name and namespace in other branches
  1. 7.3 footnotes_wysiwyg/footnotes_wysiwyg.module \footnotes_wysiwyg_wysiwyg_plugin()
  2. 7.2 footnotes_wysiwyg/footnotes_wysiwyg.module \footnotes_wysiwyg_wysiwyg_plugin()

Implementation of hook_wysiwyg_plugin().

File

footnotes_wysiwyg/footnotes_wysiwyg.module, line 13
WYSIWYG support for the footnotes module. Currently this supports TinyMCE and CKEditor via the WYSIWYG module and CKEditor via the CKEditor module.

Code

function footnotes_wysiwyg_wysiwyg_plugin($editor, $version) {
  $plugin = array(
    'footnotes' => array(
      'buttons' => array(
        'footnotes' => t('Add Footnote'),
      ),
      'basePath' => base_path(),
      // This is required to auto-load the plugin.
      'load' => TRUE,
    ),
  );
  switch ($editor) {
    case 'tinymce':
      if ($version > 3) {
        $plugin['footnotes']['filename'] = 'editor_plugin.js';
        $plugin['footnotes']['path'] = drupal_get_path('module', 'footnotes_wysiwyg') . '/tinymce_plugin/';
        $plugin['footnotes']['extended_valid_elements'] = array(
          'fn',
        );
        return $plugin;
      }
      break;
    case 'ckeditor':

      // For CKEditor, path must be to the directory, not the .js file. The .js file must be called 'plugin.js'.
      // (If including filename here, images to the buttons (defined in js/css)
      // are lost because they are appended to this path.)
      $plugin['footnotes']['path'] = drupal_get_path('module', 'footnotes_wysiwyg') . '/ckeditor_plugin/';
      return $plugin;
  }
}