Difference between revisions of "Hooks"
From Tweeki
Line 10: | Line 10: | ||
=== SkinTweekiAdditionalBodyClasses === | === SkinTweekiAdditionalBodyClasses === | ||
− | add classes to the <code><body></code> tag | + | Use this hook in order to add dynamic custom classes to the <code><body></code> tag. |
− | public static function onSkinTweekiAdditionalBodyClasses( $skinTweeki, &$additionalBodyClasses ) { . | + | public static function onSkinTweekiAdditionalBodyClasses( $skinTweeki, &$additionalBodyClasses ) { |
+ | $newClass = 'rand' . rand(0,1); | ||
+ | $additionalBodyClasses[] = $newClass; | ||
+ | return true; | ||
+ | } | ||
$wgHooks['SkinTweekiAdditionalBodyClasses'][] = 'MyExtensionHooks::onSkinTweekiAdditionalBodyClasses'; | $wgHooks['SkinTweekiAdditionalBodyClasses'][] = 'MyExtensionHooks::onSkinTweekiAdditionalBodyClasses'; |
Revision as of 07:08, 5 April 2016
SkinTweekiStyleModules
works similar to SkinVectorStyleModules
public static function onSkinTweekiStyleModules( $skinTweeki, &$styles ) { ... }
$wgHooks['SkinTweekiStyleModules'][] = 'MyExtensionHooks::onSkinTweekiStyleModules';
SkinTweekiAdditionalBodyClasses
Use this hook in order to add dynamic custom classes to the <body>
tag.
public static function onSkinTweekiAdditionalBodyClasses( $skinTweeki, &$additionalBodyClasses ) { $newClass = 'rand' . rand(0,1); $additionalBodyClasses[] = $newClass; return true; }
$wgHooks['SkinTweekiAdditionalBodyClasses'][] = 'MyExtensionHooks::onSkinTweekiAdditionalBodyClasses';