diff --git a/code/Controller/AssetAdmin.php b/code/Controller/AssetAdmin.php index 86ac05769..3e92dc32b 100644 --- a/code/Controller/AssetAdmin.php +++ b/code/Controller/AssetAdmin.php @@ -710,8 +710,8 @@ public function apiHistory(HTTPRequest $request): HTTPResponse $output[] = array( 'versionid' => (int) $version->Version, - 'date_ago' => $version->dbObject('LastEdited')->Ago(), - 'date_formatted' => $version->dbObject('LastEdited')->Nice(), + 'date_ago' => $version->dbObject('LastEdited')?->Ago(), + 'date_formatted' => $version->dbObject('LastEdited')?->Nice(), 'status' => ($version->WasPublished) ? _t(__CLASS__.'.PUBLISHED', 'Published') : '', 'author' => ($author) ? $author->Name @@ -1604,10 +1604,9 @@ public function canView($member = null) public function PreviewPanel() { $templates = SSViewer::get_templates_by_class(get_class($this), '_PreviewPanel', __CLASS__); - $template = SSViewer::chooseTemplate($templates); // Only render preview panel if a template specifically for the asset admin has been provided - if ($template) { - return $this->renderWith($template); + if ($this->getTemplateEngine()->hasTemplate($templates)) { + return $this->renderWith($templates); } return null; } diff --git a/code/Forms/FileHistoryFormFactory.php b/code/Forms/FileHistoryFormFactory.php index 1c90b1f52..b6d2d095b 100644 --- a/code/Forms/FileHistoryFormFactory.php +++ b/code/Forms/FileHistoryFormFactory.php @@ -36,7 +36,7 @@ protected function getSpecsMarkup($record) ? _t(__CLASS__ . '.PUBLISHED', 'Published') : _t(__CLASS__ . '.SAVED', 'Saved'), Convert::raw2att($record->LastEdited), - Convert::raw2xml($record->dbObject('LastEdited')->Ago()) + Convert::raw2xml($record->dbObject('LastEdited')?->Ago()) ); return sprintf( '
%s %s, %s %s
',