function hook_editor_js_settings_alter

Same name and namespace in other branches
  1. 9 core/modules/editor/editor.api.php \hook_editor_js_settings_alter()
  2. 8.9.x core/modules/editor/editor.api.php \hook_editor_js_settings_alter()
  3. 10 core/modules/editor/editor.api.php \hook_editor_js_settings_alter()

Modifies JavaScript settings that are added for text editors.

Parameters

array $settings: All the settings that will be added to the page for the text formats to which a user has access.

Related topics

1 function implements hook_editor_js_settings_alter()

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_js_settings_alter in core/modules/editor/tests/modules/editor_test/editor_test.module
Implements hook_editor_js_settings_alter().
1 invocation of hook_editor_js_settings_alter()
EditorManager::getAttachments in core/modules/editor/src/Plugin/EditorManager.php
Retrieves text editor libraries and JavaScript settings.

File

core/modules/editor/editor.api.php, line 36

Code

function hook_editor_js_settings_alter(array &$settings) {
    if (isset($settings['editor']['formats']['basic_html'])) {
        $settings['editor']['formats']['basic_html']['editor'] = 'MyDifferentEditor';
        $settings['editor']['formats']['basic_html']['editorSettings']['buttons'] = [
            'strong',
            'italic',
            'underline',
        ];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.