function hook_INCLUDE_plugin in Wysiwyg 5.2
Same name and namespace in other branches
- 6.2 wysiwyg.api.php \hook_INCLUDE_plugin()
- 7.2 wysiwyg.api.php \hook_INCLUDE_plugin()
Define a Wysiwyg plugin.
Supposed to be used for "Drupal plugins" (cross-editor plugins) only.
Each plugin file in the specified plugin directory of a module needs to define meta information about the particular plugin provided. The plugin's hook implementation function name is built out of the following:
- 'hook': The name of the module providing the plugin.
- 'INCLUDE': The basename of the file containing the plugin definition.
- 'plugin': Static.
For example, if your module's name is 'mymodule' and mymodule_wysiwyg_include_directory() returned 'plugins' as plugin directory, and this directory contains an "awesome" plugin file named 'awesome.inc', i.e. sites/all/modules/mymodule/plugins/awesome.inc then the corresponding plugin hook function name is: mymodule_awesome_plugin()
Return value
Meta information about the buttons provided by this plugin.
See also
hook_wysiwyg_include_directory()
1 function implements hook_INCLUDE_plugin()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- wysiwyg_break_plugin in plugins/
break.inc - Implementation of hook_wysiwyg_plugin().
File
- ./
wysiwyg.api.php, line 138 - Wysiwyg API documentation.
Code
function hook_INCLUDE_plugin() {
$plugins['awesome'] = array(
// The plugin's title; defaulting to its internal name ('awesome').
'title' => t('Awesome plugin'),
// The (vendor) homepage of this plugin; defaults to ''.
'vendor url' => 'http://drupal.org/project/wysiwyg',
// The path to the button's icon; defaults to
// '/[path-to-module]/[plugins-directory]/[plugin-name]/images'.
'icon path' => 'path to icon',
// The button image filename; defaults to '[plugin-name].png'.
'icon file' => 'name of the icon file with extension',
// The button title to display on hover.
'icon title' => t('Do something'),
// An alternative path to the integration JavaScript; defaults to
// '[path-to-module]/[plugins-directory]/[plugin-name]'.
'js path' => drupal_get_path('module', 'mymodule') . '/awesomeness',
// An alternative filename of the integration JavaScript; defaults to
// '[plugin-name].js'.
'js file' => 'awesome.js',
// An alternative path to the integration stylesheet; defaults to
// '[path-to-module]/[plugins-directory]/[plugin-name]'.
'css path' => drupal_get_path('module', 'mymodule') . '/awesomeness',
// An alternative filename of the integration stylesheet; defaults to
// '[plugin-name].css'.
'css file' => 'awesome.css',
// An array of settings for this button. Required, but API is still in flux.
'settings' => array(
// 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'),
),
// TinyMCE-specific: Additional HTML elements to allow in the markup.
'extended_valid_elements' => array(
'tag1[attribute1|attribute2]',
'tag2[attribute3|attribute4]',
),
);
return $plugins;
}