If the page has related articles, is in mainspace, isn't the main page,
and the output is being rendered with the MinervaBeta skin then a
"Related Articles" section is added to the page just before the footer.
Separate loading the information necessary to render the pages, choosing
the renderer, and rendering the data so that multiple skins - currently
Minerva and Vector per the mocks - not just multiple resolutions can all
be handled the same way:
* The bootstrap script (ext.relatedArticles.readMore.bootstrap/index.js)
for fetches the page image and Wikidata description; loading the
renderer module; and, finally, notifying the renderer module that it
should render the data, which it does by emitting
"ext.relatedArticles.readMore.init" event using mw#track
* The Minerva renderer subscribes to the event and, when it's fired,
renders the data by passing it to the WatchstarPageList view
Bug: T113635
Change-Id: I651342bdf9796938fa7051828dd13bc6fe774783
While the related parser function sets the accumulated related pages as
extension data on the parser output
(see RelatedArticles\Hooks::onFuncRelated). The ParserClearState
handler, however, sets the empty list as a property, which is then
stored in the DB.
Changes:
* Make RelatedArticles\Hooks::onParserClearState use
ParserOutput#setExtensionData, mirroring ::onFuncRelated
* Add a unit test for the the handler
Bug: T115698
Change-Id: I3deaf1e8ee78944250c3f26315ee2450b444a035
Since CustomData was written ParserOutput now supports the setting
and getting of properties. This patch switches RelatedArticles to use
that. I'm not sure if any other extensions depend on CustomData but
it seems to have served its purpose.
Bug: T114915
Change-Id: I30bd17fd8c43422fe7ab6f58a74565674e15ba1d
Add extension.json and populate it with information from both
RelatedArticles.php and the RelatedArticles extension wiki page [0].
Migrate the hook handlers to static functions operating on static data
rather than having a single, global instance of RelatedArticles so that
the hook handler definitions can be added to extension.json easily.
N.B. During testing the handlers for both the SkinBuildSidebar and
SkinTemplateToolboxEnd appeared to have the same effect so the TODO was
removed but not the handler for the former.
Additional changes include:
* RelatedArticles.class.php -> includes/RelatedArticles.php
* RelatedArticles -> RelatedArticles\Hooks
* Documenting all of the methods of RelatedArticles\Hooks
[0] https://www.mediawiki.org/wiki/Extension:RelatedArticles
Bug: T87965
Change-Id: I9944b9186746386ee18ca28657bb547c00ae2b8c