Allow to customise addHelpLink() target via system message
[lhc/web/wiklou.git] / includes / actions / Action.php
index ffdf516..fa75e08 100644 (file)
@@ -132,6 +132,8 @@ abstract class Action {
                if ( $actionName === 'historysubmit' ) {
                        if ( $request->getBool( 'revisiondelete' ) ) {
                                $actionName = 'revisiondelete';
+                       } elseif ( $request->getBool( 'editchangetags' ) ) {
+                               $actionName = 'editchangetags';
                        } else {
                                $actionName = 'view';
                        }
@@ -351,7 +353,7 @@ abstract class Action {
                $out = $this->getOutput();
                $out->setRobotPolicy( "noindex,nofollow" );
                $out->setPageTitle( $this->getPageTitle() );
-               $this->getOutput()->setSubtitle( $this->getDescription() );
+               $out->setSubtitle( $this->getDescription() );
                $out->setArticleRelated( true );
        }
 
@@ -374,6 +376,25 @@ abstract class Action {
                return $this->msg( strtolower( $this->getName() ) )->escaped();
        }
 
+       /**
+        * Adds help link with an icon via page indicators.
+        * Link target can be overridden by a local message containing a wikilink:
+        * the message key is: lowercase action name + '-helppage'.
+        * @param string $to Target MediaWiki.org page title or encoded URL.
+        * @param bool $overrideBaseUrl Whether $url is a full URL, to avoid MW.o.
+        * @since 1.25
+        */
+       public function addHelpLink( $to, $overrideBaseUrl = false ) {
+               $msg = wfMessage( $wgContLang->lc( $this->getActionName() ) . '-helppage' );
+
+               if ( !$msg->isDisabled() ) {
+                       $helpUrl = Skin::makeUrl( $msg->plain() );
+                       $this->getOutput()->addHelpLink( $helpUrl, true );
+               } else {
+                       $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
+               }
+       }
+
        /**
         * The main action entry point.  Do all output for display and send it to the context
         * output.  Do not use globals $wgOut, $wgRequest, etc, in implementations; use