Extension:TemplateStyles/TemplateStylesStylesheetSanitizer

From MediaWiki.org
Jump to navigation Jump to search
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( &$sanitizer, $propertySanitizer, $matcherFactory ) { ... }
Attach hook:
$wgHooks['TemplateStylesStylesheetSanitizer'][] = 'MyExtensionHooks::onTemplateStylesStylesheetSanitizer';
Called from:File(s): TemplateStylesHooks.php

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

Details[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.