function hook_editor_xss_filter_alter
Same name in other branches
- 9 core/modules/editor/editor.api.php \hook_editor_xss_filter_alter()
- 8.9.x core/modules/editor/editor.api.php \hook_editor_xss_filter_alter()
- 10 core/modules/editor/editor.api.php \hook_editor_xss_filter_alter()
Modifies the text editor XSS filter that will used for the given text format.
Is only called when an EditorXssFilter will effectively be used; this hook does not allow one to alter that decision.
Parameters
string &$editor_xss_filter_class: The text editor XSS filter class that will be used.
\Drupal\filter\FilterFormatInterface $format: The text format configuration entity. Provides context based upon which one may want to adjust the filtering.
\Drupal\filter\FilterFormatInterface|null $original_format: (optional) The original text format configuration entity (when switching text formats/editors). Also provides context based upon which one may want to adjust the filtering.
See also
\Drupal\editor\EditorXssFilterInterface
Related topics
1 function implements hook_editor_xss_filter_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_xss_filter_alter in core/
modules/ editor/ tests/ modules/ editor_test/ editor_test.module - Implements hook_editor_xss_filter_alter().
1 invocation of hook_editor_xss_filter_alter()
- editor_filter_xss in core/
modules/ editor/ editor.module - Applies text editor XSS filtering.
File
-
core/
modules/ editor/ editor.api.php, line 61
Code
function hook_editor_xss_filter_alter(&$editor_xss_filter_class, FilterFormatInterface $format, ?FilterFormatInterface $original_format = NULL) {
$filters = $format->filters()
->getAll();
if (isset($filters['filter_wysiwyg']) && $filters['filter_wysiwyg']->status) {
$editor_xss_filter_class = '\\Drupal\\filter_wysiwyg\\EditorXssFilter\\WysiwygFilter';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.