Allowing Message objects to be passed as error page title.
authorTyler Anthony Romeo <tylerromeo@gmail.com>
Mon, 6 Aug 2012 21:07:24 +0000 (17:07 -0400)
committerTyler Anthony Romeo <tylerromeo@gmail.com>
Tue, 7 Aug 2012 13:17:57 +0000 (09:17 -0400)
Changed OutputPage::showErrorPage() so that the title parameter
can be either a string or a Message object, just like the
message parameter. This allows titles that take parameters.

Change-Id: Icb7f7b0db8599984774f438333b60d66956b6075
Signed-off-by: Tyler Anthony Romeo <tylerromeo@gmail.com>
includes/OutputPage.php

index bf70467..6c1ac4b 100644 (file)
@@ -2053,13 +2053,18 @@ class OutputPage extends ContextSource {
         *
         * showErrorPage( 'titlemsg', 'pagetextmsg', array( 'param1', 'param2' ) );
         * showErrorPage( 'titlemsg', $messageObject );
+        * showErrorPage( $titleMessageObj, $messageObject );
         *
-        * @param $title String: message key for page title
+        * @param $title Mixed: message key (string) for page title, or a Message object
         * @param $msg Mixed: message key (string) for page text, or a Message object
         * @param $params Array: message parameters; ignored if $msg is a Message object
         */
        public function showErrorPage( $title, $msg, $params = array() ) {
-               $this->prepareErrorPage( $this->msg( $title ), $this->msg( 'errorpagetitle' ) );
+               if( !$title instanceof Message ) {
+                       $title = $this->msg( $title );
+               }
+
+               $this->prepareErrorPage( $title, $this->msg( 'errorpagetitle' ) );
 
                if ( $msg instanceof Message ){
                        $this->addHTML( $msg->parse() );