Pimcore\Model\Document\Tag\Embed::frontend PHP Method

frontend() public method

See also: Document\Tag\TagInterface::frontend
public frontend ( ) : string
return string
    public function frontend()
    {
        if ($this->url) {
            $config = $this->getOptions();
            if (!isset($config["params"])) {
                $config["params"] = [];
            }
            foreach (["width", "height"] as $property) {
                if (isset($config[$property])) {
                    $config["params"][$property] = $config[$property];
                }
            }
            $cacheKey = "doc_embed_" . crc32(serialize([$this->url, $config]));
            if (!($html = \Pimcore\Cache::load($cacheKey))) {
                $embera = new \Embera\Embera($config);
                $html = $embera->autoEmbed($this->url);
                \Pimcore\Cache::save($html, $cacheKey, ["embed"], 86400, 1, true);
            }
            return $html;
        }
        return "";
    }