コード例 #1
0
ファイル: Image.php プロジェクト: pawansgi92/pimcore2
 /**
  * Converts the data so it's suitable for the editmode
  *
  * @return array
  */
 public function getDataEditmode()
 {
     if ($this->image instanceof Asset\Image) {
         $rewritePath = function ($data) {
             if (!is_array($data)) {
                 return array();
             }
             foreach ($data as &$element) {
                 if (array_key_exists("data", $element) && is_array($element["data"]) && count($element["data"]) > 0) {
                     foreach ($element["data"] as &$metaData) {
                         if ($metaData["value"] instanceof Element\ElementInterface) {
                             $metaData["value"] = $metaData["value"]->getFullPath();
                         }
                     }
                 }
             }
             return $data;
         };
         $marker = $rewritePath($this->marker);
         $hotspots = $rewritePath($this->hotspots);
         return array("id" => $this->id, "path" => $this->image->getPath() . $this->image->getFilename(), "alt" => $this->alt, "cropPercent" => $this->cropPercent, "cropWidth" => $this->cropWidth, "cropHeight" => $this->cropHeight, "cropTop" => $this->cropTop, "cropLeft" => $this->cropLeft, "hotspots" => $hotspots, "marker" => $marker);
     }
     return null;
 }