Page MenuHomePhabricator

allow CategoryPageView to set $mCategoryViewerClass
Closed, ResolvedPublic

Description

The $mCategoryViewerClass variable defined in CategoryPage is protected, and therefore that prevent the hook CategoryPageView to override the viewer class without extending CategoryPage and rewrite the function CategoryPage::view() where this hook is raised.

An example of current implementation is this extension :
https://phabricator.wikimedia.org/diffusion/SVN/browse/trunk/extensions/PeopleCategories/PeopleCategories.php
https://phabricator.wikimedia.org/diffusion/SVN/browse/trunk/extensions/PeopleCategories/PeopleCategories.body.php

We can see that the MediaWiki source code evolved since this extension has been written. But we force the author of the extension to duplicate the code while implementing PeopleCategoriesPage. If $mCategoryViewerClass was public, he could do this:

$wgHooks['CategoryPageView'][] = 'efPeopleCategories';

function efPeopleCategories( &$categoryArticle ) {
	$categoryArticle->mCategoryViewerClass = 'PeopleCategoriesViewer';
}

... and implement only PeopleCategoriesViewer.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 29 2017, 2:24 AM

Change 357899 had a related patch set uploaded (by Louperivois; owner: Louperivois):
[mediawiki/core@master] FIX T166483 : Allow CategoryPageView to set $mCategoryViewerClass

https://gerrit.wikimedia.org/r/357899

Change 357899 had a related patch set uploaded (by Louperivois; owner: Louperivois):
[mediawiki/core@master] Allow CategoryPageView to set $mCategoryViewerClass

https://gerrit.wikimedia.org/r/357899

Change 357899 merged by jenkins-bot:
[mediawiki/core@master] Allow CategoryPageView to set $mCategoryViewerClass

https://gerrit.wikimedia.org/r/357899

matmarex closed this task as Resolved.Jun 12 2017, 6:46 PM
matmarex assigned this task to Louperivois.
matmarex removed a project: Patch-For-Review.