Craft\EmbeddedAssetsPlugin::_getThumbnails PHP Method

_getThumbnails() private method

This method is used to inject the asset thumbnails into the CP front-end. Since embedded asset files are stored as JSON files, there's no supported way of setting the thumbnail on the front-end for these files. The alternative is to pass a list of these thumbnails to the front-end, and use JS to patch them on-top of the elements system.
private _getThumbnails ( ) : array
return array
    private function _getThumbnails()
    {
        $cacheKey = self::getCacheKey();
        $cache = craft()->cache->get($cacheKey);
        if (!$cache) {
            $prefix = self::getFileNamePrefix();
            $assets = craft()->elements->getCriteria(ElementType::Asset, array('kind' => 'json', 'filename' => $prefix . '*', 'limit' => null))->find();
            $thumbnails = array();
            foreach ($assets as $asset) {
                $embed = craft()->embeddedAssets->getEmbeddedAsset($asset);
                if ($embed) {
                    $thumbnails[$asset->id] = $embed->thumbnailUrl;
                }
            }
            craft()->cache->set($cacheKey, $thumbnails);
            $cache = $thumbnails;
        }
        return $cache;
    }