Pimcore\Model\Document\Tag\Image::getDataEditmode PHP Method

getDataEditmode() public method

Converts the data so it's suitable for the editmode
public getDataEditmode ( ) : array
return array
    public function getDataEditmode()
    {
        $image = $this->getImage();
        if ($image instanceof Asset\Image) {
            $rewritePath = function ($data) {
                if (!is_array($data)) {
                    return [];
                }
                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"]->getRealFullPath();
                            }
                        }
                    }
                }
                return $data;
            };
            $marker = $rewritePath($this->marker);
            $hotspots = $rewritePath($this->hotspots);
            $marker = object2array($marker);
            $hotspots = object2array($hotspots);
            return ["id" => $this->id, "path" => $image->getFullPath(), "alt" => $this->alt, "cropPercent" => $this->cropPercent, "cropWidth" => $this->cropWidth, "cropHeight" => $this->cropHeight, "cropTop" => $this->cropTop, "cropLeft" => $this->cropLeft, "hotspots" => $hotspots, "marker" => $marker];
        }
        return null;
    }