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

getDataEditmode() public method

public getDataEditmode ( )
    public function getDataEditmode()
    {
        $rewritePath = function ($data) {
            if (!is_array($data)) {
                return [];
            }
            foreach ($data as &$page) {
                foreach ($page 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;
        };
        $hotspots = $rewritePath($this->hotspots);
        $pages = 0;
        if ($asset = Asset::getById($this->id)) {
            $pages = $asset->getPageCount();
        }
        $texts = $this->texts;
        // force an object when converting to JSON
        $texts["__dummy"] = "__dummy";
        return ["id" => $this->id, "pageCount" => $pages, "hotspots" => empty($hotspots) ? null : $hotspots, "texts" => $texts, "chapters" => $this->chapters];
    }