Ejemplo n.º 1
0
 /**
  * @see Object_Class_Data::getDataForEditmode
  * @param float $data
  * @return float
  */
 public function getDataForEditmode($data, $object = null)
 {
     if ($data instanceof \Object_Data_QuantityValue) {
         return array("value" => $data->getValue(), "unit" => $data->getUnitId());
     }
     return;
 }
Ejemplo n.º 2
0
 /**
  * @see Object_Class_Data::getVersionPreview
  * @param float $data
  * @param null|Model\Object\AbstractObject $object
  * @param mixed $params
  * @return float
  */
 public function getVersionPreview($data, $object = null, $params = [])
 {
     if ($data instanceof \Pimcore\Model\Object\Data\QuantityValue) {
         $unit = "";
         if ($data->getUnitId()) {
             $unitDefinition = Model\Object\QuantityValue\Unit::getById($data->getUnitId());
             if ($unitDefinition) {
                 $unit = " " . $unitDefinition->getAbbreviation();
             }
         }
         return $data->getValue() . $unit;
     }
     return "";
 }