r85925 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85924‎ | r85925 | r85926 >
Date:21:56, 12 April 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
SMW 1.6 style param handling support
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php
@@ -172,11 +172,27 @@
173173 public function getParameters() {
174174 $params = parent::getParameters();
175175
176 - $params[] = array( 'name' => 'perrow', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_perrow' ) );
177 - $params[] = array( 'name' => 'widths', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_widths' ) );
178 - $params[] = array( 'name' => 'heights', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_heights' ) );
179 -
180 - $params[] = array( 'name' => 'autocaptions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_autocaptions' ), 'values' => array( 'on', 'off' ) );
 176+ if ( defined( 'SMW_SUPPORTS_VALIDATOR' ) ) {
 177+ $params['perrow'] = new Parameter( 'perrow', Parameter::TYPE_INTEGER );
 178+ $params['perrow']->setDescription( wfMsg( 'srf_paramdesc_perrow' ) );
 179+
 180+ $params['widths'] = new Parameter( 'widths', Parameter::TYPE_INTEGER );
 181+ $params['widths']->setDescription( wfMsg( 'srf_paramdesc_widths' ) );
 182+
 183+ $params['heights'] = new Parameter( 'heights', Parameter::TYPE_INTEGER );
 184+ $params['heights']->setDescription( wfMsg( 'srf_paramdesc_heights' ) );
 185+
 186+ $params['autocaptions'] = new Parameter( 'autocaptions', Parameter::TYPE_BOOLEAN );
 187+ $params['autocaptions']->setDescription( wfMsg( 'srf_paramdesc_autocaptions' ) );
 188+ }
 189+ else {
 190+ // This if for b/c with SMW 1.5.x; SMW 1.6 directly accepts Parameter objects.
 191+ $params[] = array( 'name' => 'perrow', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_perrow' ) );
 192+ $params[] = array( 'name' => 'widths', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_widths' ) );
 193+ $params[] = array( 'name' => 'heights', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_heights' ) );
 194+
 195+ $params[] = array( 'name' => 'autocaptions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_autocaptions' ), 'values' => array( 'on', 'off' ) );
 196+ }
181197
182198 return $params;
183199 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r85926follow up to r85925jeroendedauw22:09, 12 April 2011

Status & tagging log