r97805 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97804‎ | r97805 | r97806 >
Date:09:31, 22 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
add subject print request to API
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
@@ -186,11 +186,11 @@
187187 return $query;
188188 }
189189
190 - protected static function addThisPrinteout( array &$printRequests, array $rawParams ) {
191 - $rawParams['mainlabel'] = array_key_exists( 'mainlabel', $rawParams ) ? $rawParams['mainlabel'] : false;
 190+ public static function addThisPrinteout( array &$printRequests, array $rawParams, $isShow = false ) {
 191+ $rawParams['mainlabel'] = ( !$isShow && array_key_exists( 'mainlabel', $rawParams ) ) ? $rawParams['mainlabel'] : false;
192192 $noMainlabel = $rawParams['mainlabel'] === '-';
193193 // !$desc->isSingleton() || count( $printRequests ) == 0 ) && ( !$noMainlabel )
194 - //var_dump($printRequests);exit;
 194+
195195 if ( !is_null( $printRequests ) && !$noMainlabel ) {
196196 array_unshift( $printRequests, new SMWPrintRequest(
197197 SMWPrintRequest::PRINT_THIS,
Index: trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php
@@ -27,6 +27,8 @@
2828 * @return SMWQuery
2929 */
3030 protected function getQuery( $queryString, array $printeouts ) {
 31+ SMWQueryProcessor::addThisPrinteout( $printeouts, $this->parameters );
 32+
3133 return SMWQueryProcessor::createQuery(
3234 $queryString,
3335 SMWQueryProcessor::getProcessedParams( $this->parameters, $printeouts ),