Index: branches/ArticleCreationWorkflow/phase3/docs/hooks.txt |
— | — | @@ -587,6 +587,15 @@ |
588 | 588 | Change $bad and return false to override. If an image is "bad", it is not |
589 | 589 | rendered inline in wiki pages or galleries in category pages. |
590 | 590 | |
| 591 | +'BeforeDisplayNoArticleText': before displaying noarticletext or noarticletext-nopermission |
| 592 | +at Article::showMissingArticle() |
| 593 | + |
| 594 | +$article: article object |
| 595 | +&$text: text replacing 'noarticletext' |
| 596 | +$errors: creating/editing article error |
| 597 | +$wgUser: current user object |
| 598 | +&$wikiText: boolean for determining if $text is wikitext |
| 599 | + |
591 | 600 | 'BeforeInitialize': before anything is initialized in MediaWiki::performRequest() |
592 | 601 | &$title: Title being used for request |
593 | 602 | $unused: null |
Index: branches/ArticleCreationWorkflow/phase3/includes/Article.php |
— | — | @@ -988,6 +988,8 @@ |
989 | 989 | 'msgKey' => array( 'moveddeleted-notice' ) ) |
990 | 990 | ); |
991 | 991 | |
| 992 | + $text = ''; |
| 993 | + $wikiText = true; |
992 | 994 | # Show error message |
993 | 995 | $oldid = $this->getOldID(); |
994 | 996 | if ( $oldid ) { |
— | — | @@ -1002,10 +1004,13 @@ |
1003 | 1005 | $editErrors = $this->getTitle()->getUserPermissionsErrors( 'edit', $wgUser ); |
1004 | 1006 | $errors = array_merge( $createErrors, $editErrors ); |
1005 | 1007 | |
1006 | | - if ( !count( $errors ) ) { |
1007 | | - $text = wfMsgNoTrans( 'noarticletext' ); |
1008 | | - } else { |
1009 | | - $text = wfMsgNoTrans( 'noarticletext-nopermission' ); |
| 1008 | + wfRunHooks( 'BeforeDisplayNoArticleText', array( $this, &$text, $errors, $wgUser, &$wikiText ) ); |
| 1009 | + if ( !$text ) { |
| 1010 | + if ( !count( $errors ) ) { |
| 1011 | + $text = wfMsgNoTrans( 'noarticletext' ); |
| 1012 | + } else { |
| 1013 | + $text = wfMsgNoTrans( 'noarticletext-nopermission' ); |
| 1014 | + } |
1010 | 1015 | } |
1011 | 1016 | } |
1012 | 1017 | $text = "<div class='noarticletext'>\n$text\n</div>"; |
— | — | @@ -1016,7 +1021,7 @@ |
1017 | 1022 | $wgRequest->response()->header( "HTTP/1.1 404 Not Found" ); |
1018 | 1023 | } |
1019 | 1024 | |
1020 | | - $wgOut->addWikiText( $text ); |
| 1025 | + $wikiText ? $wgOut->addWikiText( $text ) : $wgOut->addHTML( $text ); |
1021 | 1026 | } |
1022 | 1027 | |
1023 | 1028 | /** |