mediawiki-extensions-Catego.../CategoryPageSubclass.php
Chad Horohoe a4493424fd Swap $mCategoryViewerClass to be public like its parent
Needed after I9937148dd8114e7167d6a581e64bfed5fdcc568e

Change-Id: Iea507743a7f03ae01aa5869e9a30e3dcbce8f5ce
2017-06-13 12:16:39 -07:00

65 lines
1.4 KiB
PHP

<?php
class CategoryTreeCategoryPage extends CategoryPage {
public $mCategoryViewerClass = 'CategoryTreeCategoryViewer';
}
class CategoryTreeCategoryViewer extends CategoryViewer {
public $child_cats;
/**
* @var CategoryTree
*/
public $categorytree;
/**
* @return CategoryTree
*/
function getCategoryTree() {
global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeForceHeaders;
if ( !isset( $this->categorytree ) ) {
if ( !$wgCategoryTreeForceHeaders ) {
CategoryTree::setHeaders( $this->getOutput() );
}
$this->categorytree = new CategoryTree( $wgCategoryTreeCategoryPageOptions );
}
return $this->categorytree;
}
/**
* Add a subcategory to the internal lists
* @param $cat Category
* @param $sortkey
* @param $pageLength
*/
function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
$title = $cat->getTitle();
if ( $this->getRequest()->getCheck( 'notree' ) ) {
parent::addSubcategoryObject( $cat, $sortkey, $pageLength );
return;
}
$tree = $this->getCategoryTree();
$this->children[] = $tree->renderNodeInfo( $title, $cat );
$this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey );
}
function clearCategoryState() {
$this->child_cats = [];
parent::clearCategoryState();
}
function finaliseCategoryState() {
if ( $this->flip ) {
$this->child_cats = array_reverse( $this->child_cats );
}
parent::finaliseCategoryState();
}
}