r65040 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65039‎ | r65040 | r65041 >
Date:21:42, 14 April 2010
Author:happy-melon
Status:reverted (Comments)
Tags:
Comment:
From r64866, more consistent behaviour of hidden field names. May affect r65029.
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HTMLForm.php
@@ -305,7 +305,8 @@
306306 * @param $attribs Array
307307 */
308308 public function addHiddenField( $name, $value, $attribs=array() ){
309 - $this->mHiddenFields[ $name ] = array( $value, $attribs );
 309+ $attribs += array( 'name' => $name );
 310+ $this->mHiddenFields[] = array( $value, $attribs );
310311 }
311312
312313 public function addButton( $name, $value, $id=null, $attribs=null ){
@@ -377,9 +378,9 @@
378379 $html .= Html::hidden( 'wpEditToken', $wgUser->editToken(), array( 'id' => 'wpEditToken' ) ) . "\n";
379380 $html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
380381
381 - foreach( $this->mHiddenFields as $name => $value ){
382 - list( $value, $attribs ) = $value;
383 - $html .= Html::hidden( $name, $value, $attribs ) . "\n";
 382+ foreach( $this->mHiddenFields as $data ){
 383+ list( $value, $attribs ) = $data;
 384+ $html .= Html::hidden( $attribs['name'], $value, $attribs ) . "\n";
384385 }
385386
386387 return $html;
@@ -1397,6 +1398,13 @@
13981399
13991400 class HTMLHiddenField extends HTMLFormField {
14001401
 1402+ public function __construct( $params ){
 1403+ parent::__construct( $params );
 1404+ # forcing the 'wp' prefix on hidden field names
 1405+ # is undesirable
 1406+ $this->mName = substr( $this->mName, 2 );
 1407+ }
 1408+
14011409 public function getTableRow( $value ){
14021410 $params = array();
14031411 if( $this->mID ){

Follow-up revisions

RevisionCommit summaryAuthorDate
r67277Follow-up to r64903; fix field names broken by r65040.happy-melon09:43, 3 June 2010
r78452Clean up the running mess that is r64866, r65040, and then r67277. Implement...happy-melon21:14, 15 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64866Improvements and fixes to HTMLForm:...happy-melon12:03, 10 April 2010
r65029Follow-up to r65027: Prefix all hidden fields with wp. This was not necessary...btongminh14:47, 14 April 2010

Comments

#Comment by Werdna (talk | contribs)   01:30, 9 December 2010

Why is this special case necessary?

Status & tagging log