Pimcore\Model\Object\ClassDefinition\Data\Hotspotimage::getCacheTags PHP Method

getCacheTags() public method

This is a dummy and is mostly implemented by relation types
public getCacheTags ( mixed $data, array $tags = [] ) : array
$data mixed
$tags array
return array
    public function getCacheTags($data, $tags = [])
    {
        $tags = is_array($tags) ? $tags : [];
        if ($data instanceof Object\Data\Hotspotimage && $data->getImage() instanceof Asset\Image) {
            if (!array_key_exists($data->getImage()->getCacheTag(), $tags)) {
                $tags = $data->getImage()->getCacheTags($tags);
            }
            $getMetaDataCacheTags = function ($d, $tags) {
                if (!is_array($d)) {
                    return $tags;
                }
                foreach ($d 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) {
                                if (!array_key_exists($metaData["value"]->getCacheTag(), $tags)) {
                                    $tags = $metaData["value"]->getCacheTags($tags);
                                }
                            }
                        }
                    }
                }
                return $tags;
            };
            $marker = $data->getMarker();
            $hotspots = $data->getHotspots();
            $tags = $getMetaDataCacheTags($marker, $tags);
            $tags = $getMetaDataCacheTags($hotspots, $tags);
        }
        return $tags;
    }