You are here

function hook_ckeditor_PLUGIN_plugin_check in CKEditor for WYSIWYG Module 7

Same name and namespace in other branches
  1. 8 ckeditor.api.php \hook_ckeditor_PLUGIN_plugin_check()

Enabled callback for hook_ckeditor_plugins().

Note: This is not really a hook. The function name is manually specified via 'enabled callback' in hook_ckeditor_plugins(), with this recommended callback name pattern. It is called from ckeditor_add_settings().

This callback should determine if a plugin should be enabled for a CKEditor instance. Plugins may be enabled based off an explicit setting, or enable themselves based on the configuration of another setting, such as enabling based on a particular button being present in the toolbar.

Parameters

object $editor: An editor instance as returned by editor_load(). The editor's settings may be found in $editor->settings.

string $plugin_name: String name of the plugin that is being checked.

Return value

boolean Boolean TRUE if the plugin should be enabled, FALSE otherwise.

See also

hook_ckeditor_plugins()

ckeditor_add_settings()

File

./ckeditor.api.php, line 149
Documentation for CKEditor module APIs.

Code

function hook_ckeditor_PLUGIN_plugin_check($editor, $plugin_name) {

  // Automatically enable this plugin if the Underline button is enabled.
  foreach ($editor->settings['toolbar']['buttons'] as $row) {
    if (in_array('Underline', $row)) {
      return TRUE;
    }
  }
}