danielebarchiesi@0: 3) { danielebarchiesi@0: return array( danielebarchiesi@0: 'myplugin' => array( danielebarchiesi@0: // A URL to the plugin's homepage. danielebarchiesi@0: 'url' => 'http://drupal.org/project/img_assist', danielebarchiesi@0: // The full path to the native editor plugin, no trailing slash. danielebarchiesi@0: // Ignored when 'internal' is set to TRUE below. danielebarchiesi@0: 'path' => drupal_get_path('module', 'img_assist') . '/drupalimage', danielebarchiesi@0: // The name of the plugin's main JavaScript file. danielebarchiesi@0: // Ignored when 'internal' is set to TRUE below. danielebarchiesi@0: // Default value depends on which editor the plugin is for. danielebarchiesi@0: 'filename' => 'editor_plugin.js', danielebarchiesi@0: // A list of buttons provided by this native plugin. The key has to danielebarchiesi@0: // match the corresponding JavaScript implementation. The value is danielebarchiesi@0: // is displayed on the editor configuration form only. danielebarchiesi@0: 'buttons' => array( danielebarchiesi@0: 'img_assist' => t('Image Assist'), danielebarchiesi@0: ), danielebarchiesi@0: // A list of editor extensions provided by this native plugin. danielebarchiesi@0: // Extensions are not displayed as buttons and touch the editor's danielebarchiesi@0: // internals, so you should know what you are doing. danielebarchiesi@0: 'extensions' => array( danielebarchiesi@0: 'imce' => t('IMCE'), danielebarchiesi@0: ), danielebarchiesi@0: // A list of global, native editor configuration settings to danielebarchiesi@0: // override. To be used rarely and only when required. danielebarchiesi@0: 'options' => array( danielebarchiesi@0: 'file_browser_callback' => 'imceImageBrowser', danielebarchiesi@0: 'inline_styles' => TRUE, danielebarchiesi@0: ), danielebarchiesi@0: // Boolean whether the editor needs to load this plugin. When TRUE, danielebarchiesi@0: // the editor will automatically load the plugin based on the 'path' danielebarchiesi@0: // variable provided. If FALSE, the plugin either does not need to danielebarchiesi@0: // be loaded or is already loaded by something else on the page. danielebarchiesi@0: // Most plugins should define TRUE here. danielebarchiesi@0: 'load' => TRUE, danielebarchiesi@0: // Boolean whether this plugin is a native plugin, i.e. shipped with danielebarchiesi@0: // the editor. Definition must be ommitted for plugins provided by danielebarchiesi@0: // other modules. TRUE means 'path' and 'filename' above are ignored danielebarchiesi@0: // and the plugin is instead loaded from the editor's plugin folder. danielebarchiesi@0: 'internal' => TRUE, danielebarchiesi@0: // TinyMCE-specific: Additional HTML elements to allow in the markup. danielebarchiesi@0: 'extended_valid_elements' => array( danielebarchiesi@0: 'img[class|src|border=0|alt|title|width|height|align|name|style]', danielebarchiesi@0: ), danielebarchiesi@0: ), danielebarchiesi@0: ); danielebarchiesi@0: } danielebarchiesi@0: break; danielebarchiesi@0: } danielebarchiesi@0: } danielebarchiesi@0: danielebarchiesi@0: /** danielebarchiesi@0: * Register a directory containing Wysiwyg plugins. danielebarchiesi@0: * danielebarchiesi@0: * @param $type danielebarchiesi@0: * The type of objects being collected: either 'plugins' or 'editors'. danielebarchiesi@0: * @return danielebarchiesi@0: * A sub-directory of the implementing module that contains the corresponding danielebarchiesi@0: * plugin files. This directory must only contain integration files for danielebarchiesi@0: * Wysiwyg module. danielebarchiesi@0: */ danielebarchiesi@0: function hook_wysiwyg_include_directory($type) { danielebarchiesi@0: switch ($type) { danielebarchiesi@0: case 'plugins': danielebarchiesi@0: // You can just return $type, if you place your Wysiwyg plugins into a danielebarchiesi@0: // sub-directory named 'plugins'. danielebarchiesi@0: return $type; danielebarchiesi@0: } danielebarchiesi@0: } danielebarchiesi@0: danielebarchiesi@0: /** danielebarchiesi@0: * Define a Wysiwyg plugin. danielebarchiesi@0: * danielebarchiesi@0: * Supposed to be used for "Drupal plugins" (cross-editor plugins) only. danielebarchiesi@0: * danielebarchiesi@0: * @see hook_wysiwyg_plugin() danielebarchiesi@0: * danielebarchiesi@0: * Each plugin file in the specified plugin directory of a module needs to danielebarchiesi@0: * define meta information about the particular plugin provided. danielebarchiesi@0: * The plugin's hook implementation function name is built out of the following: danielebarchiesi@0: * - 'hook': The name of the module providing the plugin. danielebarchiesi@0: * - 'INCLUDE': The basename of the file containing the plugin definition. danielebarchiesi@0: * - 'plugin': Static. danielebarchiesi@0: * danielebarchiesi@0: * For example, if your module's name is 'mymodule' and danielebarchiesi@0: * mymodule_wysiwyg_include_directory() returned 'plugins' as plugin directory, danielebarchiesi@0: * and this directory contains an "awesome" plugin file named 'awesome.inc', i.e. danielebarchiesi@0: * sites/all/modules/mymodule/plugins/awesome.inc danielebarchiesi@0: * then the corresponding plugin hook function name is: danielebarchiesi@0: * mymodule_awesome_plugin() danielebarchiesi@0: * danielebarchiesi@0: * @see hook_wysiwyg_include_directory() danielebarchiesi@0: * danielebarchiesi@0: * @return danielebarchiesi@0: * Meta information about the buttons provided by this plugin. danielebarchiesi@0: */ danielebarchiesi@0: function hook_INCLUDE_plugin() { danielebarchiesi@0: $plugins['awesome'] = array( danielebarchiesi@0: // The plugin's title; defaulting to its internal name ('awesome'). danielebarchiesi@0: 'title' => t('Awesome plugin'), danielebarchiesi@0: // The (vendor) homepage of this plugin; defaults to ''. danielebarchiesi@0: 'vendor url' => 'http://drupal.org/project/wysiwyg', danielebarchiesi@0: // The path to the button's icon; defaults to danielebarchiesi@0: // '/[path-to-module]/[plugins-directory]/[plugin-name]/images'. danielebarchiesi@0: 'icon path' => 'path to icon', danielebarchiesi@0: // The button image filename; defaults to '[plugin-name].png'. danielebarchiesi@0: 'icon file' => 'name of the icon file with extension', danielebarchiesi@0: // The button title to display on hover. danielebarchiesi@0: 'icon title' => t('Do something'), danielebarchiesi@0: // An alternative path to the integration JavaScript; defaults to danielebarchiesi@0: // '[path-to-module]/[plugins-directory]/[plugin-name]'. danielebarchiesi@0: 'js path' => drupal_get_path('module', 'mymodule') . '/awesomeness', danielebarchiesi@0: // An alternative filename of the integration JavaScript; defaults to danielebarchiesi@0: // '[plugin-name].js'. danielebarchiesi@0: 'js file' => 'awesome.js', danielebarchiesi@0: // An alternative path to the integration stylesheet; defaults to danielebarchiesi@0: // '[path-to-module]/[plugins-directory]/[plugin-name]'. danielebarchiesi@0: 'css path' => drupal_get_path('module', 'mymodule') . '/awesomeness', danielebarchiesi@0: // An alternative filename of the integration stylesheet; defaults to danielebarchiesi@0: // '[plugin-name].css'. danielebarchiesi@0: 'css file' => 'awesome.css', danielebarchiesi@0: // An array of settings for this button. Required, but API is still in flux. danielebarchiesi@0: 'settings' => array( danielebarchiesi@0: ), danielebarchiesi@0: // TinyMCE-specific: Additional HTML elements to allow in the markup. danielebarchiesi@0: 'extended_valid_elements' => array( danielebarchiesi@0: 'tag1[attribute1|attribute2]', danielebarchiesi@0: 'tag2[attribute3|attribute4]', danielebarchiesi@0: ), danielebarchiesi@0: ); danielebarchiesi@0: return $plugins; danielebarchiesi@0: } danielebarchiesi@0: danielebarchiesi@0: /** danielebarchiesi@0: * Define a Wysiwyg editor library. danielebarchiesi@0: * danielebarchiesi@0: * @todo Complete this documentation. danielebarchiesi@0: */ danielebarchiesi@0: function hook_INCLUDE_editor() { danielebarchiesi@0: $editor['ckeditor'] = array( danielebarchiesi@0: // The official, human-readable label of the editor library. danielebarchiesi@0: 'title' => 'CKEditor', danielebarchiesi@0: // The URL to the library's homepage. danielebarchiesi@0: 'vendor url' => 'http://ckeditor.com', danielebarchiesi@0: // The URL to the library's download page. danielebarchiesi@0: 'download url' => 'http://ckeditor.com/download', danielebarchiesi@0: // A definition of available variants for the editor library. danielebarchiesi@0: // The first defined is used by default. danielebarchiesi@0: 'libraries' => array( danielebarchiesi@0: '' => array( danielebarchiesi@0: 'title' => 'Default', danielebarchiesi@0: 'files' => array( danielebarchiesi@0: 'ckeditor.js' => array('preprocess' => FALSE), danielebarchiesi@0: ), danielebarchiesi@0: ), danielebarchiesi@0: 'src' => array( danielebarchiesi@0: 'title' => 'Source', danielebarchiesi@0: 'files' => array( danielebarchiesi@0: 'ckeditor_source.js' => array('preprocess' => FALSE), danielebarchiesi@0: ), danielebarchiesi@0: ), danielebarchiesi@0: ), danielebarchiesi@0: // (optional) A callback to invoke to return additional notes for installing danielebarchiesi@0: // the editor library in the administrative list/overview. danielebarchiesi@0: 'install note callback' => 'wysiwyg_ckeditor_install_note', danielebarchiesi@0: // A callback to determine the library's version. danielebarchiesi@0: 'version callback' => 'wysiwyg_ckeditor_version', danielebarchiesi@0: // A callback to return available themes/skins for the editor library. danielebarchiesi@0: 'themes callback' => 'wysiwyg_ckeditor_themes', danielebarchiesi@0: // (optional) A callback to perform editor-specific adjustments or danielebarchiesi@0: // enhancements for the administrative editor profile settings form. danielebarchiesi@0: 'settings form callback' => 'wysiwyg_ckeditor_settings_form', danielebarchiesi@0: // (optional) A callback to return an initialization JavaScript snippet for danielebarchiesi@0: // this editor library, loaded before the actual library files. The returned danielebarchiesi@0: // JavaScript is executed as inline script in a primitive environment, danielebarchiesi@0: // before the DOM is loaded; typically used to prime a base path and other danielebarchiesi@0: // global window variables for the editor library before it is loaded. danielebarchiesi@0: // All implementations should verbosely document what they are doing and danielebarchiesi@0: // why that is required. danielebarchiesi@0: 'init callback' => 'wysiwyg_ckeditor_init', danielebarchiesi@0: // A callback to convert administrative profile/editor settings into danielebarchiesi@0: // JavaScript settings. danielebarchiesi@0: 'settings callback' => 'wysiwyg_ckeditor_settings', danielebarchiesi@0: // A callback to supply definitions of available editor plugins. danielebarchiesi@0: 'plugin callback' => 'wysiwyg_ckeditor_plugins', danielebarchiesi@0: // A callback to convert administrative plugin settings for a editor profile danielebarchiesi@0: // into JavaScript settings. danielebarchiesi@0: 'plugin settings callback' => 'wysiwyg_ckeditor_plugin_settings', danielebarchiesi@0: // (optional) Defines the proxy plugin that handles plugins provided by danielebarchiesi@0: // Drupal modules, which work in all editors that support proxy plugins. danielebarchiesi@0: 'proxy plugin' => array( danielebarchiesi@0: 'drupal' => array( danielebarchiesi@0: 'load' => TRUE, danielebarchiesi@0: 'proxy' => TRUE, danielebarchiesi@0: ), danielebarchiesi@0: ), danielebarchiesi@0: // (optional) A callback to convert proxy plugin settings into JavaScript danielebarchiesi@0: // settings. danielebarchiesi@0: 'proxy plugin settings callback' => 'wysiwyg_ckeditor_proxy_plugin_settings', danielebarchiesi@0: // Defines the list of supported (minimum) versions of the editor library, danielebarchiesi@0: // and the respective Drupal integration files to load. danielebarchiesi@0: 'versions' => array( danielebarchiesi@0: '3.0.0.3665' => array( danielebarchiesi@0: 'js files' => array('ckeditor-3.0.js'), danielebarchiesi@0: ), danielebarchiesi@0: ), danielebarchiesi@0: ); danielebarchiesi@0: return $editor; danielebarchiesi@0: } danielebarchiesi@0: danielebarchiesi@0: /** danielebarchiesi@0: * Act on editor profile settings. danielebarchiesi@0: * danielebarchiesi@0: * This hook is invoked from wysiwyg_get_editor_config() after the JavaScript danielebarchiesi@0: * settings have been generated for an editor profile and before the settings danielebarchiesi@0: * are added to the page. The settings may be customized or enhanced; typically danielebarchiesi@0: * with options that cannot be controlled through Wysiwyg module's danielebarchiesi@0: * administrative UI currently. danielebarchiesi@0: * danielebarchiesi@0: * Modules implementing this hook to enforce settings that can also be danielebarchiesi@0: * controlled through the UI should also implement danielebarchiesi@0: * hook_form_wysiwyg_profile_form_alter() to adjust or at least indicate on the danielebarchiesi@0: * editor profile configuration form that certain/affected settings cannot be danielebarchiesi@0: * changed. danielebarchiesi@0: * danielebarchiesi@0: * @param $settings danielebarchiesi@0: * An associative array of JavaScript settings to pass to the editor. danielebarchiesi@0: * @param $context danielebarchiesi@0: * An associative array containing additional context information: danielebarchiesi@0: * - editor: The plugin definition array of the editor. danielebarchiesi@0: * - profile: The editor profile object, as loaded from the database. danielebarchiesi@0: * - theme: The name of the editor theme/skin. danielebarchiesi@0: */ danielebarchiesi@0: function hook_wysiwyg_editor_settings_alter(&$settings, $context) { danielebarchiesi@0: // Each editor has its own collection of native settings that may be extended danielebarchiesi@0: // or overridden. Please consult the respective official vendor documentation danielebarchiesi@0: // for details. danielebarchiesi@0: if ($context['profile']->editor == 'tinymce') { danielebarchiesi@0: // Supported values to JSON data types. danielebarchiesi@0: $settings['cleanup_on_startup'] = TRUE; danielebarchiesi@0: } danielebarchiesi@0: }