You are here

function hook_wysiwyg_plugin in Wysiwyg 5.2

Same name and namespace in other branches
  1. 5 wysiwyg.api.php \hook_wysiwyg_plugin()
  2. 6.2 wysiwyg.api.php \hook_wysiwyg_plugin()
  3. 6 wysiwyg.api.php \hook_wysiwyg_plugin()
  4. 7.2 wysiwyg.api.php \hook_wysiwyg_plugin()

Return an array of native editor plugins.

Only to be used for native (internal) editor plugins.

Parameters

$editor: The internal name of the currently processed editor.

$version: The version of the currently processed editor.

Return value

An associative array having internal plugin names as keys and an array of plugin meta-information as values.

See also

hook_wysiwyg_include_directory()

1 invocation of hook_wysiwyg_plugin()
wysiwyg_get_plugins in ./wysiwyg.module
Return plugin metadata from the plugin registry.

File

./wysiwyg.api.php, line 38
Wysiwyg API documentation.

Code

function hook_wysiwyg_plugin($editor, $version) {
  switch ($editor) {
    case 'tinymce':
      if ($version > 3) {
        return array(
          'myplugin' => array(
            // A URL to the plugin's homepage.
            'url' => 'http://drupal.org/project/img_assist',
            // The full path to the native editor plugin.
            'path' => drupal_get_path('module', 'img_assist') . '/drupalimage/editor_plugin.js',
            // A list of buttons provided by this native plugin. The key has to
            // match the corresponding JavaScript implementation. The value is
            // is displayed on the editor configuration form only.
            'buttons' => array(
              'img_assist' => t('Image Assist'),
            ),
            // A list of editor extensions provided by this native plugin.
            // Extensions are not displayed as buttons and touch the editor's
            // internals, so you should know what you are doing.
            'extensions' => array(
              'imce' => t('IMCE'),
            ),
            // A list of global, native editor configuration settings to
            // override. To be used rarely and only when required.
            'options' => array(
              'file_browser_callback' => 'imceImageBrowser',
              'inline_styles' => TRUE,
              // Function references (callbacks) need special care.
              // @see wysiwyg_wrap_js_callback()
              'file_browser_callback' => wysiwyg_wrap_js_callback('myFileBrowserCallback'),
              // Regular Expressions need special care.
              // @see wysiwyg_wrap_js_regexp()
              'stylesheetParser_skipSelectors' => wysiwyg_wrap_js_regexp('(^body\\.|^caption\\.|\\.high|^\\.)', 'i'),
            ),
            // Boolean whether the editor needs to load this plugin. When TRUE,
            // the editor will automatically load the plugin based on the 'path'
            // variable provided. If FALSE, the plugin either does not need to
            // be loaded or is already loaded by something else on the page.
            // Most plugins should define TRUE here.
            'load' => TRUE,
            // Boolean whether this plugin is a native plugin, i.e. shipped with
            // the editor. Definition must be ommitted for plugins provided by
            // other modules.
            'internal' => TRUE,
            // TinyMCE-specific: Additional HTML elements to allow in the markup.
            'extended_valid_elements' => array(
              'img[class|src|border=0|alt|title|width|height|align|name|style]',
            ),
          ),
        );
      }
      break;
  }
}