function hook_editor_default_settings

Provides defaults for editor instances.

Modules that extend the list of settings for a particular text editor library should specify defaults for those settings using this hook. These settings will be used for any new editors, as well as merged into any existing editor configuration that has not yet been provided with a specific value for a setting (as may happen when a module providing a new setting is enabled after the text editor has been configured).

Note that only the top-level of this array is merged into the defaults. If multiple modules provide nested settings with the same top-level key, only the first will be used. Modules should avoid deep nesting of settings to avoid defaults being undefined.

The return value of this hook is not cached. If retrieving defaults in a complex manner, the implementing module should provide its own caching inside the hook.

Parameters

$editor: A string indicating the name of the editor library whose default settings are being provided.

Return value

array An array of default settings that will be merged into the editor defaults.

Related topics

1 function implements hook_editor_default_settings()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

editor_test_editor_default_settings in drupal/core/modules/editor/tests/modules/editor_test.module
Implements hook_editor_default_settings().
1 invocation of hook_editor_default_settings()
Editor::__construct in drupal/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php
Overrides Drupal\Core\Entity\Entity::__construct()

File

drupal/core/modules/editor/editor.api.php, line 53
Documentation for Text Editor API.

Code

function hook_editor_default_settings($editor) {
  return array(
    'mymodule_new_setting1' => TRUE,
    'mymodule_new_setting2' => array(
      'foo' => 'baz',
      'bar' => 'qux',
    ),
  );
}