Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / editor / tests / modules / editor_test.module
1 <?php
2
3 /**
4  * @file
5  * Helper module for the Text Editor tests.
6  */
7
8 use Drupal\filter\FilterFormatInterface;
9
10 /**
11  * Implements hook_editor_js_settings_alter().
12  */
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)) {
16     return;
17   }
18
19   if (isset($settings['editor']['formats']['full_html'])) {
20     $settings['editor']['formats']['full_html']['editorSettings']['ponyModeEnabled'] = FALSE;
21   }
22 }
23
24 /**
25  * Implements hook_editor_xss_filter_alter().
26  */
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)) {
30     return;
31   }
32
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';
36   }
37 }
38
39 /**
40  * Implements hook_editor_info_alter().
41  */
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']);
45   }
46 }