r100205 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100204‎ | r100205 | r100206 >
Date:02:47, 19 October 2011
Author:yaron
Status:deferred
Tags:
Comment:
Fix for r100006 - fixed handling of schema elements that have no name
Modified paths:
  • /trunk/extensions/PageSchemas/PageSchemas.classes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/PageSchemas.classes.php
@@ -144,10 +144,11 @@
145145 $text .= self::tableRowHTML( 'pageSchemaHeader', 'Page schema' );
146146
147147 foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
148 - list( $elementName, $values ) = call_user_func( array( $psHandlerClass, 'getSchemaDisplayValues' ), $schemaXML );
149 - if ( is_null( $elementName ) ) {
 148+ $returnVals = call_user_func( array( $psHandlerClass, 'getSchemaDisplayValues' ), $schemaXML );
 149+ if ( count( $returnVals ) != 2 ) {
150150 continue;
151151 }
 152+ list( $elementName, $values ) = $returnVals;
152153 $label = call_user_func( array( $psHandlerClass, 'getSchemaDisplayString' ) );
153154 $bgColor = call_user_func( array( $psHandlerClass, 'getDisplayColor' ) );
154155 $text .= self::tableRowHTML( 'schemaExtensionRow', $label, $elementName, $bgColor );
@@ -175,10 +176,11 @@
176177 }
177178
178179 foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
179 - list( $elementName, $values ) = call_user_func( array( $psHandlerClass, 'getTemplateDisplayValues' ), $templateXML );
180 - if ( is_null( $elementName ) ) {
 180+ $returnVals = call_user_func( array( $psHandlerClass, 'getTemplateDisplayValues' ), $templateXML );
 181+ if ( count( $returnVals ) != 2 ) {
181182 continue;
182183 }
 184+ list( $elementName, $values ) = $returnVals;
183185 $label = call_user_func( array( $psHandlerClass, 'getTemplateDisplayString' ) );
184186 $bgColor = call_user_func( array( $psHandlerClass, 'getDisplayColor' ) );
185187 $text .= self::tableRowHTML( 'fieldExtensionRow', $label, $elementName, $bgColor );
@@ -214,10 +216,11 @@
215217 // Let extensions that store data within the Page Schemas XML
216218 // each handle displaying their data, by adding to this array.
217219 foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
218 - list( $elementName, $values ) = call_user_func( array( $psHandlerClass, 'getFieldDisplayValues' ), $fieldXML );
219 - if ( is_null( $elementName ) ) {
 220+ $returnVals = call_user_func( array( $psHandlerClass, 'getFieldDisplayValues' ), $fieldXML );
 221+ if ( count( $returnVals ) != 2 ) {
220222 continue;
221223 }
 224+ list( $elementName, $values ) = $returnVals;
222225 $label = call_user_func( array( $psHandlerClass, 'getFieldDisplayString' ) );
223226 $bgColor = call_user_func( array( $psHandlerClass, 'getDisplayColor' ) );
224227 $text .= self::tableRowHTML( 'fieldExtensionRow', $label, $elementName, $bgColor );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100006Another overhaul - changed hook system for extensions to instead use an entir...yaron01:25, 17 October 2011

Status & tagging log