Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php |
— | — | @@ -34,28 +34,34 @@ |
35 | 35 | public static function addGeoCoordsDefaultFormat( &$format, array $printRequests, array $params ) { |
36 | 36 | // Only set the format when not set yet. This allows other extensions to override the Semantic Maps behaviour. |
37 | 37 | if ( $format === false ) { |
38 | | - $allCoords = true; |
39 | | - $hasNonPage = false; |
40 | | - |
41 | | - // Loop through the print requests to determine their types. |
42 | | - foreach( $printRequests as $printRequest ) { |
43 | | - $typeId = $printRequest->getTypeID(); |
| 38 | + // Only apply when there is more then one print request. |
| 39 | + // This way requests comming from #show are ignored. |
| 40 | + if ( count( $printRequests ) > 1 ) { |
| 41 | + $allCoords = true; |
| 42 | + $first = true; |
44 | 43 | |
45 | | - // Ignore the page type. |
46 | | - if ( $typeId != '_wpg' ) { |
47 | | - $hasNonPage = true; |
| 44 | + // Loop through the print requests to determine their types. |
| 45 | + foreach( $printRequests as $printRequest ) { |
| 46 | + // Skip the first request, as it's the object. |
| 47 | + if ( $first ) { |
| 48 | + $first = false; |
| 49 | + continue; |
| 50 | + } |
48 | 51 | |
| 52 | + $typeId = $printRequest->getTypeID(); |
| 53 | + |
49 | 54 | if ( $typeId != '_geo' ) { |
50 | 55 | $allCoords = false; |
51 | 56 | break; |
52 | 57 | } |
53 | 58 | } |
| 59 | + |
| 60 | + // If they are all coordinates, set the result format to 'map'. |
| 61 | + if ( $allCoords ) { |
| 62 | + $format = 'map'; |
| 63 | + } |
54 | 64 | } |
55 | | - |
56 | | - // If they are all coordinates, set the result format to 'map'. |
57 | | - if ( $allCoords && $hasNonPage ) { |
58 | | - $format = 'map'; |
59 | | - } |
| 65 | + |
60 | 66 | } |
61 | 67 | |
62 | 68 | return true; |