Allow specifying OutputPage object in Skin::subPageSubtitle parameters
[lhc/web/wiklou.git] / includes / skins / Skin.php
index fa46a46..729f564 100644 (file)
@@ -646,18 +646,22 @@ abstract class Skin extends ContextSource {
        }
 
        /**
+        * @param OutputPage $out Defaults to $this->getOutput() if left as null
         * @return string
         */
-       function subPageSubtitle() {
-               $out = $this->getOutput();
+       function subPageSubtitle( $out = null ) {
+               if ( $out === null ) {
+                       $out = $this->getOutput();
+               }
+               $title = $out->getTitle();
                $subpages = '';
 
                if ( !Hooks::run( 'SkinSubPageSubtitle', [ &$subpages, $this, $out ] ) ) {
                        return $subpages;
                }
 
-               if ( $out->isArticle() && MWNamespace::hasSubpages( $out->getTitle()->getNamespace() ) ) {
-                       $ptext = $this->getTitle()->getPrefixedText();
+               if ( $out->isArticle() && MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+                       $ptext = $title->getPrefixedText();
                        if ( strpos( $ptext, '/' ) !== false ) {
                                $links = explode( '/', $ptext );
                                array_pop( $links );