function editor_test_editor_xss_filter_alter

Same name and namespace in other branches
  1. 9 core/modules/editor/tests/modules/editor_test/editor_test.module \editor_test_editor_xss_filter_alter()
  2. 8.9.x core/modules/editor/tests/modules/editor_test.module \editor_test_editor_xss_filter_alter()
  3. 10 core/modules/editor/tests/modules/editor_test/editor_test.module \editor_test_editor_xss_filter_alter()

Implements hook_editor_xss_filter_alter().

File

core/modules/editor/tests/modules/editor_test/editor_test.module, line 64

Code

function editor_test_editor_xss_filter_alter(&$editor_xss_filter_class, FilterFormatInterface $format, ?FilterFormatInterface $original_format = NULL) {
    // Allow tests to enable or disable this alter hook.
    if (!\Drupal::state()->get('editor_test_editor_xss_filter_alter_enabled', FALSE)) {
        return;
    }
    $filters = $format->filters()
        ->getAll();
    if (isset($filters['filter_html']) && $filters['filter_html']->status) {
        $editor_xss_filter_class = '\\Drupal\\editor_test\\EditorXssFilter\\Insecure';
    }
}

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