Hooks

From Tweeki
Revision as of 21:16, 10 March 2017 by Thai (talk | contribs) (→‎SkinTweekiAdditionalBodyClasses)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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';

SkinTweekiCheckVisibility

Use this hook to dynamically hide navigational elements and sections. Returning false means the item should not be shown. The following example hides the footer for users without confirmed email address.

public static function onSkinTweekiCheckVisibility( $skinTweeki, $item ) { 
  if( $item == 'footer' && !$skinTweeki->getSkin()->getUser()->isEmailConfirmed() )
    return false;
  }
}
$wgHooks['SkinTweekiCheckVisibility'][] = 'MyExtensionHooks::onSkinTweekiCheckVisibility';