mediawiki-extensions-Discus.../includes/DiscussionToolsHooks.php
Ed Sanders 53fae97723 Add an empty hook to load discussion tools on talk pages
Change-Id: Iafa24ed41c06d4bd8b9a7a684b986fdb37aa87c7
2019-10-12 17:14:28 +00:00

31 lines
753 B
PHP

<?php
/**
* DiscussionTools extension hooks
*
* @file
* @ingroup Extensions
* @license MIT
*/
class DiscussionToolsHooks {
/**
* Adds DiscussionTools JS to the output.
*
* This is attached to the MediaWiki 'BeforePageDisplay' hook.
*
* @param OutputPage $output The page view.
* @param Skin $skin The skin that's going to build the UI.
*/
public static function onBeforePageDisplay( OutputPage $output, Skin $skin ) {
$title = $output->getTitle();
if (
// Only wikitext pages (e.g. not Flow boards)
$title->getContentModel() === CONTENT_MODEL_WIKITEXT &&
$title->isTalkPage()
// TODO: Allow non talk pages to be treated as talk pages
// using a magic word.
) {
// TODO: Load talk page enhancements
}
}
}