You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
734 B
PHTML

3 years ago
<?php
namespace Isekai\OffcanvasToc;
use MediaWiki\MediaWikiServices;
3 years ago
class Hooks {
public static function onLoad(\OutputPage $outputPage) {
$service = MediaWikiServices::getInstance();
if (
$outputPage->getTitle()->isContentPage() &&
$service->getUserOptionsLookup()->getOption($outputPage->getUser(), 'offcanvas-toc-enabled')
) {
2 years ago
$outputPage->addModules(['ext.isekai.offcanvas-toc']);
}
}
public static function onGetPreferences(\User $user, array &$preferences) {
$preferences['offcanvas-toc-enabled'] = [
'type' => 'toggle',
'label-message' => 'offcanvas-toc-enabled',
'section' => 'rendering/offcanvas-toc'
];
return true;
3 years ago
}
}