Source of file DataObjectPreviewer.php
Size: 0,856 Bytes - Last Modified: 2021-12-24T06:51:11+00:00
/var/www/docs.ssmods.com/process/src/code/DataObjectPreviewer.php
12345678910111213141516171819202122232425262728293031323334353637 | <?php /** * Class DataObjectPreviewer */ class DataObjectPreviewer { /** * @param DataObjectPreviewInterface $record * @return string */ public function preview(DataObjectPreviewInterface $record) { $content = $record->getPreviewHtml(); $contentMd5 = md5($content); $htmlFilepath = sprintf( '%s/%s.html', DATAOBJECTPREVIEW_CACHE_PATH, $contentMd5 ); if (!file_exists(DATAOBJECTPREVIEW_CACHE_PATH)) { mkdir(DATAOBJECTPREVIEW_CACHE_PATH); } if (!file_exists($htmlFilepath)) { file_put_contents($htmlFilepath, $content); } return sprintf( '<div class="dataobjectpreview" data-src="%s"></div>', str_replace(BASE_PATH . '/', '', $htmlFilepath) ); } } |