diff --git a/src/AssetControlExtension.php b/src/AssetControlExtension.php index 32e77890..ac1a7790 100644 --- a/src/AssetControlExtension.php +++ b/src/AssetControlExtension.php @@ -247,7 +247,7 @@ protected function findAssets(DataObject $record) } // Omit variant and merge with set - $next = $record->dbObject($field)->getValue(); + $next = $record->dbObject($field)?->getValue(); unset($next['Variant']); if ($next) { $files[] = $next; diff --git a/src/File.php b/src/File.php index 03fca21b..3739b382 100644 --- a/src/File.php +++ b/src/File.php @@ -1322,16 +1322,14 @@ public function forTemplate(): string /** * Return a html5 tag of the appropriate for this file (normally img or a) - * - * @return string */ - public function getTag() + public function getTag(): string { $template = $this->File->getFrontendTemplate(); if (empty($template)) { return ''; } - return (string)$this->renderWith($template); + return $this->renderWith($template); } /** diff --git a/tests/php/ImageManipulationTest.php b/tests/php/ImageManipulationTest.php index 5e815f0a..d771ac26 100644 --- a/tests/php/ImageManipulationTest.php +++ b/tests/php/ImageManipulationTest.php @@ -24,6 +24,7 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\View\SSViewer; use PHPUnit\Framework\Attributes\DataProvider; +use SilverStripe\View\SSViewer_FromString; /** * ImageTest is abstract and should be overridden with manipulator-specific subtests @@ -450,7 +451,7 @@ public function testRender(string $template, string $expected) $this->assertEquals( $expected, - trim($image->renderWith(SSViewer::fromString($template)) ?? '') + trim($image->renderWith(SSViewer_FromString::create($template)) ?? '') ); }