mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 23:18:10 +00:00
feat: enhanced device support when rendering mashups
This commit is contained in:
parent
19a8bb18cc
commit
ee9f21a83d
2 changed files with 8 additions and 2 deletions
|
|
@ -135,10 +135,13 @@ class PlaylistItem extends Model
|
|||
/**
|
||||
* Render all plugins with appropriate layout
|
||||
*/
|
||||
public function render(): string
|
||||
public function render(?Device $device = null): string
|
||||
{
|
||||
if (! $this->isMashup()) {
|
||||
return view('trmnl-layouts.single', [
|
||||
'colorDepth' => $device?->deviceModel?->color_depth,
|
||||
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
|
||||
'scaleLevel' => $device?->deviceModel?->scale_level,
|
||||
'slot' => $this->plugin instanceof Plugin
|
||||
? $this->plugin->render('full', false)
|
||||
: throw new Exception('Invalid plugin instance'),
|
||||
|
|
@ -160,6 +163,9 @@ class PlaylistItem extends Model
|
|||
}
|
||||
|
||||
return view('trmnl-layouts.mashup', [
|
||||
'colorDepth' => $device?->deviceModel?->color_depth,
|
||||
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
|
||||
'scaleLevel' => $device?->deviceModel?->scale_level,
|
||||
'mashupLayout' => $this->getMashupLayoutType(),
|
||||
'slot' => implode('', $pluginMarkups),
|
||||
])->render();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue