You are here

function hook_wysiwyg_plugin in Wysiwyg 7.2

Same name and namespace in other branches
  1. 5.2 wysiwyg.api.php \hook_wysiwyg_plugin()
  2. 5 wysiwyg.api.php \hook_wysiwyg_plugin()
  3. 6.2 wysiwyg.api.php \hook_wysiwyg_plugin()
  4. 6 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
API documentation for Wysiwyg module.

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, no trailing slash.
            // Ignored when 'internal' is set to TRUE below.
            'path' => drupal_get_path('module', 'img_assist') . '/drupalimage',
            // The name of the plugin's main JavaScript file.
            // Ignored when 'internal' is set to TRUE below.
            // Default value depends on which editor the plugin is for.
            'filename' => '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.
            // CKEditor-specific note: The internal button name/key is
            // capitalized, i.e. Img_assist.
            '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,
            ),
            // 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 omitted for plugins provided by
            // other modules. TRUE means 'path' and 'filename' above are ignored
            // and the plugin is instead loaded from the editor's plugin folder.
            '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;
  }
}