hook_editor_xss_filter_alter(&$editor_xss_filter_class, FilterFormatInterface $format, FilterFormatInterface $original_format = NULL)
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 $original_format|null: (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
- Hooks
- Define functions that alter the behavior of Drupal core.
File
- core/modules/editor/editor.api.php, line 61
- Documentation for Text Editor API.
Code
1 2 3 4 5 6 | 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' ; } } |
Please login to continue.