1.20.x filter.api.php hook_editor_info()

Define text editors, such as WYSIWYGs or toolbars to assist with text input.

Text editors are bound to an individual text format. When a format is activated in a 'text_format' element, the text editor associated with the format should be activated on the text area.

Return value

An associative array of editors, whose keys are internal editor names,: which should be unique and therefore prefixed with the name of the module. Each value is an associative array describing the editor, with the following elements (all are optional except as noted):

  • label: (required) A human readable name for the editor.
  • settings callback: The name of a function that returns configuration form elements for the editor. See hook_editor_EDITOR_settings() for details.
  • default settings: An associative array containing default settings for the editor, to be applied when the editor has not been configured yet.
  • file: The name of a file containing the editor settings callback.
  • library: An associative array containing an optional library.
  • js settings callback: The name of a function that returns configuration options that should be added to the page via JavaScript for use on the client side. See hook_editor_EDITOR_js_settings() for details.

See also

ckeditor.module

hook_editor_info_alter()

Related topics

File

modules/filter/filter.api.php, line 152
Hooks provided by the Filter module.

Code

function hook_editor_info() {
  $editors['myeditor'] = array(
    'label' => t('My Editor'),
    'settings callback' => '_myeditor_settings',
    'default settings' => array(
      'enable_toolbar' => TRUE,
      'toolbar_buttons' => array('bold', 'italic', 'underline', 'link', 'image'),
      'resizeable' => TRUE,
    ),
    'file' => 'myeditor.admin.inc',
    'library' => array('mymodule', 'myeditor'),
    'js settings callback' => '_myeditor_js_settings',
  );
  return $editors;
}