Extension:TemplateStyles/Hooks/TemplateStylesStylesheetSanitizer

From Linux Web Expert

Revision as of 08:48, 3 September 2023 by imported>Clump (Reverted edits by 197.211.58.198 (talk) to last version by SamanthaNguyen)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

&$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.