Skip to content

Commit

Permalink
Adjusted to use match
Browse files Browse the repository at this point in the history
  • Loading branch information
LuomaJuha committed Sep 12, 2024
1 parent 047d057 commit c6fe1b5
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions module/Finna/src/Finna/RecordDriver/SolrLido.php
Original file line number Diff line number Diff line change
Expand Up @@ -941,16 +941,24 @@ protected function getVideo(
string $description
): array {
if ($codec = $this->supportedVideoFormats[$format] ?? false) {
return [
'desc' => $description ?: false,
'url' => $url,
'embed' => 'video',
'format' => $format,
'videoSources' => [
'src' => $url,
'type' => $codec,
return match ($codec) {
'iframe' => [
'desc' => $description ?: false,
'url' => $url,
'embed' => 'iframe',
'format' => $format,
],
];
default => [
'desc' => $description ?: false,
'url' => $url,
'embed' => $codec !== 'iframe' ? 'video' : 'iframe',
'format' => $format,
'videoSources' => [
'src' => $url,
'type' => $codec,
],
],
};
}
return [];
}
Expand Down

0 comments on commit c6fe1b5

Please sign in to comment.