Example #1
0
 /**
  * Get a single data value item
  *
  * @since 1.8
  *
  * @param integer $type
  * @param SMWDataValue $dataValue
  *
  * @return mixed
  */
 private function getDataValueItem($type, SMWDataValue $dataValue)
 {
     if ($type == SMWDataItem::TYPE_NUMBER) {
         // Set unit if available
         $dataValue->setOutputFormat($this->params['unit']);
         // Check if unit is available and return the converted value otherwise
         // just return a plain number
         return $dataValue->getUnit() !== '' ? $dataValue->getShortWikiText() : $dataValue->getNumber();
     } else {
         // For all other data types return the wikivalue
         return $dataValue->getWikiValue();
     }
 }