Jump to content

Extension:TemplateStyles/Hooks/TemplateStylesStylesheetSanitizer

From mediawiki.org
TemplateStylesStylesheetSanitizer
Available from version ???
Allows for adjusting or replacing the StylesheetSanitizer. For example, you might add, remove, or redefine at-rule sanitizers.
Define function:
public static function onTemplateStylesStylesheetSanitizer( Wikimedia\CSS\Sanitizer\StylesheetSanitizer &$sanitizer, Wikimedia\CSS\Sanitizer\StylePropertySanitizer $propertySanitizer, Wikimedia\CSS\Grammar\MatcherFactory $matcherFactory ) { ... }
Attach hook:
$wgHooks['TemplateStylesStylesheetSanitizer'][] = 'MyExtensionHooks::onTemplateStylesStylesheetSanitizer';
Called from:File(s): TemplateStyles / includes/TemplateStylesHooks.php
Function(s): getSanitizer

For more information about attaching hooks, see Manual:Hooks .
For examples of other extensions using this hook, see Category:TemplateStylesStylesheetSanitizer extensions.

Parameters

[edit]
&$sanitizer
Wikimedia\CSS\Sanitizer\StylesheetSanitizer to be used for sanitization. The array returned by $sanitizer->getRuleSanitizers() will use the at-rule names (including the '@') as keys. The style rule sanitizer has key 'styles'.
$propertySanitizer
Wikimedia\CSS\Sanitizer\StylePropertySanitizer being used for sanitization, for use in adding or redefining rule sanitizers.
$matcherFactory
Wikimedia\CSS\Grammar\MatcherFactory being used, for use in adding or redefining rule sanitizers.