form->fill([ 'embed_theme' => $this->getSetting('radio_embed_theme', 'dark'), 'embed_height' => $this->getSetting('radio_embed_height', '400'), 'embed_width' => $this->getSetting('radio_embed_width', '100%'), 'embed_auto_play' => $this->getSetting('radio_embed_auto_play', '0'), ]); } public function form(Schema $schema): Schema { return $schema ->components([ Section::make('Embed Configuratie') ->description('Pas het uiterlijk van de embed player aan') ->schema([ Select::make('embed_theme') ->label('Thema') ->options([ 'dark' => 'Donker', 'light' => 'Licht', 'transparent' => 'Transparant', ]) ->default('dark'), TextInput::make('embed_height') ->label('Hoogte (px)') ->numeric() ->default(400), TextInput::make('embed_width') ->label('Breedte') ->placeholder('100% of 400px') ->default('100%'), Toggle::make('embed_auto_play') ->label('Auto-Play'), ]), ]); } public function getIframeCode(): string { $theme = $this->data['embed_theme'] ?? 'dark'; $height = $this->data['embed_height'] ?? '400'; $width = $this->data['embed_width'] ?? '100%'; $autoPlay = ($this->data['embed_auto_play'] ?? false) ? '&autoplay=1' : ''; $url = route('radio.embed', ['theme' => $theme]) . $autoPlay; return ''; } public function getJsSnippet(): string { $theme = $this->data['embed_theme'] ?? 'dark'; $autoPlay = ($this->data['embed_auto_play'] ?? false) ? '&autoplay=1' : ''; $url = route('radio.embed', ['theme' => $theme]) . $autoPlay; return '
'; } public function getDirectUrl(): string { $theme = $this->data['embed_theme'] ?? 'dark'; $autoPlay = ($this->data['embed_auto_play'] ?? false) ? '&autoplay=1' : ''; return route('radio.embed', ['theme' => $theme]) . $autoPlay; } #[\Override] protected function getHeaderActions(): array { return []; } private function getSetting(string $key, mixed $default = null): mixed { $setting = WebsiteSetting::where('key', $key)->first(); return $setting?->value ?? $default; } }