Merge "New hook for readonly editpages"
authorMwalker <mwalker@wikimedia.org>
Tue, 15 Apr 2014 18:15:59 +0000 (18:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 15 Apr 2014 18:15:59 +0000 (18:15 +0000)
docs/hooks.txt
includes/EditPage.php

index a9bc736..668cc06 100644 (file)
@@ -1025,6 +1025,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 61995f2..d0bd7c7 100644 (file)
@@ -511,6 +511,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() );