5 * Helper module for the Text Editor tests.
8 use Drupal\filter\FilterFormatInterface;
11 * Implements hook_editor_js_settings_alter().
13 function editor_test_editor_js_settings_alter(&$settings) {
14 // Allow tests to enable or disable this alter hook.
15 if (!\Drupal::state()->get('editor_test_js_settings_alter_enabled', FALSE)) {
19 if (isset($settings['editor']['formats']['full_html'])) {
20 $settings['editor']['formats']['full_html']['editorSettings']['ponyModeEnabled'] = FALSE;
25 * Implements hook_editor_xss_filter_alter().
27 function editor_test_editor_xss_filter_alter(&$editor_xss_filter_class, FilterFormatInterface $format, FilterFormatInterface $original_format = NULL) {
28 // Allow tests to enable or disable this alter hook.
29 if (!\Drupal::state()->get('editor_test_editor_xss_filter_alter_enabled', FALSE)) {
33 $filters = $format->filters()->getAll();
34 if (isset($filters['filter_html']) && $filters['filter_html']->status) {
35 $editor_xss_filter_class = '\Drupal\editor_test\EditorXssFilter\Insecure';
40 * Implements hook_editor_info_alter().
42 function editor_test_editor_info_alter(&$items) {
43 if (!\Drupal::state()->get('editor_test_give_me_a_trex_thanks', FALSE)) {
44 unset($items['trex']);