r69346 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69345‎ | r69346 | r69347 >
Date:20:55, 14 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added docs
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php
@@ -33,16 +33,29 @@
3434
3535 if ( !$smwgAddedResultDefaults ) {
3636 $smwgAddedResultDefaults = true;
37 - // @since 1.5.2
 37+
 38+ /**
 39+ * This hook allows extensions to specify default result formats for
 40+ * datavalues. For example, Semantic Maps can specify the result format
 41+ * for geographical coordinates is the map one.
 42+ *
 43+ * @since 1.5.2
 44+ */
3845 wfRunHooks( 'SMWResultDefaults', array( &$smwgResultDefaults ) );
3946 }
4047
4148 $format = false;
4249
43 - // @since 1.5.2
 50+ /**
 51+ * This hook allows extensions to override SMWs implementation of default result
 52+ * format handling. Extensions might choose do so even when $smwgUseResultDefaults is false.
 53+ *
 54+ * @since 1.5.2
 55+ */
4456 wfRunHooks( 'SMWResultFormat', array( &$format, $results->getPrintRequests(), $params ) );
4557
46 - if ( $smwgUseResultDefaults && !$format && $results->getColumnCount() <= 2 ) {
 58+ // If $smwgUseResultDefaults is true, and there are no multiple columns, see if there is a default format.
 59+ if ( $smwgUseResultDefaults && $format === false && $results->getColumnCount() <= 2 ) {
4760 $printReqs = $results->getPrintRequests();
4861 $typeId = array_shift( $printReqs )->getTypeID();
4962
@@ -55,6 +68,7 @@
5669 }
5770 }
5871
 72+ // If no default was found, use a table or list, depending on the column count.
5973 if ( $format === false ) {
6074 $format = $results->getColumnCount() > 1 ? 'table' : 'list';
6175 }

Status & tagging log