From: Derk-Jan Hartman Date: Sun, 23 Mar 2014 20:07:39 +0000 (+0100) Subject: New hook for readonly editpages X-Git-Tag: 1.31.0-rc.0~16208^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=61c9dcf696398ff1b9de56e8dab0966fe2b9f01f;p=lhc%2Fweb%2Fwiklou.git New hook for readonly editpages EditPage::showReadOnlyForm:initial which is analogous to EditPage::showEditForm:initial Bug: 45258 Change-Id: I6885d617e18562acf0331e8db5790b53b489dbc2 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index e4037e6a07..d7cfe46742 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1005,6 +1005,12 @@ yourself. Alternatively, modifying $error and returning true will cause the contents of $error to be echoed at the top of the edit form as wikitext. Return true without altering $error to allow the edit to proceed. +'EditPage::showReadOnlyForm:initial: similar to EditPage::showEditForm:initial +but for the readonly 'view source' variant of the edit form. +$editor: EditPage instance (object) +&$out: an OutputPage instance to write to +return value is ignored (should alway return true) + 'EditPage::showStandardInputs:options': allows injection of form fields into the editOptions area $editor: EditPage instance (object) diff --git a/includes/EditPage.php b/includes/EditPage.php index d4b06fe35e..035c5cc67b 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -512,6 +512,8 @@ class EditPage { throw new PermissionsError( $action, $permErrors ); } + wfRunHooks( 'EditPage::showReadOnlyForm:initial', array( $this, &$wgOut ) ); + $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setPageTitle( wfMessage( 'viewsource-title', $this->getContextTitle()->getPrefixedText() ) ); $wgOut->addBacklinkSubtitle( $this->getContextTitle() );