r111565 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111564‎ | r111565 | r111566 >
Date:19:32, 15 February 2012
Author:dantman
Status:ok (Comments)
Tags:
Comment:
Add an OutputPage to the EditPage::showEditForm:initial to match the EditPage::showEditForm:fields hook so that people will stop global'ing $wgOut. e.g.: In WikiEditor.
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -774,12 +774,13 @@
775775 return value is ignored (should always return true)
776776
777777 'EditPage::showEditForm:fields': allows injection of form field into edit form
778 -&$editor: the EditPage instance for reference
779 -&$out: an OutputPage instance to write to
 778+$editor: the EditPage instance for reference
 779+$out: an OutputPage instance to write to
780780 return value is ignored (should always return true)
781781
782782 'EditPage::showEditForm:initial': before showing the edit form
783783 $editor: EditPage instance (object)
 784+$out: an OutputPage instance to write to
784785
785786 Return false to halt editing; you'll need to handle error messages, etc.
786787 yourself. Alternatively, modifying $error and returning true will cause the
Index: trunk/phase3/includes/EditPage.php
@@ -1732,7 +1732,7 @@
17331733 $previewOutput = $this->getPreviewText();
17341734 }
17351735
1736 - wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) );
 1736+ wfRunHooks( 'EditPage::showEditForm:initial', array( &$this, &$wgOut ) );
17371737
17381738 $this->setHeaders();
17391739

Comments

#Comment by Aaron Schulz (talk | contribs)   20:08, 15 February 2012

You can't just give a Context object (perhaps from outputpage)?

#Comment by Dantman (talk | contribs)   20:27, 15 February 2012

EditPage::showEditForm:fields already gives an OutputPage. OutputPage is also the thing that is most likely going to be used.

#Comment by IAlex (talk | contribs)   20:27, 15 February 2012

And please don't pass such objects by reference.

#Comment by Dantman (talk | contribs)   20:29, 15 February 2012

EditPage::showEditForm:fields was already using references, I'm just matching it. I did remove the & from documentation to try and minimize the hook uses that actually make use of references.

Status & tagging log