From 61c9dcf696398ff1b9de56e8dab0966fe2b9f01f Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Sun, 23 Mar 2014 21:07:39 +0100 Subject: [PATCH] New hook for readonly editpages EditPage::showReadOnlyForm:initial which is analogous to EditPage::showEditForm:initial Bug: 45258 Change-Id: I6885d617e18562acf0331e8db5790b53b489dbc2 --- docs/hooks.txt | 6 ++++++ includes/EditPage.php | 2 ++ 2 files changed, 8 insertions(+) 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() ); -- 2.20.1