W3cubDocs

/Drupal 8

function hook_editor_js_settings_alter

hook_editor_js_settings_alter(array &$settings)

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

Hooks
Define functions that alter the behavior of Drupal core.

File

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

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'] = array('strong', 'italic', 'underline');
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!editor!editor.api.php/function/hook_editor_js_settings_alter/8.1.x