Skip to content

Commit

Permalink
ENH Improve typing to support refactored template layer
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Sep 26, 2024
1 parent d4296a9 commit d287e85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/AssetControlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit d287e85

Please sign in to comment.