Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php |
— | — | @@ -33,16 +33,29 @@ |
34 | 34 | |
35 | 35 | if ( !$smwgAddedResultDefaults ) { |
36 | 36 | $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 | + */ |
38 | 45 | wfRunHooks( 'SMWResultDefaults', array( &$smwgResultDefaults ) ); |
39 | 46 | } |
40 | 47 | |
41 | 48 | $format = false; |
42 | 49 | |
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 | + */ |
44 | 56 | wfRunHooks( 'SMWResultFormat', array( &$format, $results->getPrintRequests(), $params ) ); |
45 | 57 | |
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 ) { |
47 | 60 | $printReqs = $results->getPrintRequests(); |
48 | 61 | $typeId = array_shift( $printReqs )->getTypeID(); |
49 | 62 | |
— | — | @@ -55,6 +68,7 @@ |
56 | 69 | } |
57 | 70 | } |
58 | 71 | |
| 72 | + // If no default was found, use a table or list, depending on the column count. |
59 | 73 | if ( $format === false ) { |
60 | 74 | $format = $results->getColumnCount() > 1 ? 'table' : 'list'; |
61 | 75 | } |