New hook for readonly editpages
authorDerk-Jan Hartman <hartman.wiki@gmail.com>
Sun, 23 Mar 2014 20:07:39 +0000 (21:07 +0100)
committerDerk-Jan Hartman <hartman.wiki@gmail.com>
Tue, 15 Apr 2014 06:46:01 +0000 (08:46 +0200)
EditPage::showReadOnlyForm:initial which is analogous to
EditPage::showEditForm:initial

Bug: 45258
Change-Id: I6885d617e18562acf0331e8db5790b53b489dbc2

docs/hooks.txt
includes/EditPage.php

index e4037e6..d7cfe46 100644 (file)
@@ -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)
index d4b06fe..035c5cc 100644 (file)
@@ -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() );