components([ $this->getTabsContentComponent(), RenderHook::make(PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE), View::make('filament.media.library'), RenderHook::make(PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_AFTER), ]); } public function showingList(): bool { return $this->ansicht === 'liste'; } /** * @return list> */ public function cards(): array { return app(MediaLibrary::class)->cards($this->libraryFilters(), ContentElementResource::editor()); } /** * @return list */ public function typeOptions(): array { return app(MediaLibrary::class)->types(); } /** * @return list */ public function pillarOptions(): array { return app(MediaLibrary::class)->pillars(); } /** * @return list */ public function classificationOptions(): array { return app(MediaLibrary::class)->classifications(); } public function filtersActive(): bool { return trim($this->suche) !== '' || $this->art !== '' || $this->freigabe !== '' || $this->entwurf !== '' || $this->fassung !== '' || $this->nutzung !== '' || $this->saeule !== '' || $this->einordnung !== '' || $this->verarbeitung !== '' || $this->archiv !== 'aktiv'; } public function resetFilters(): void { $this->suche = ''; $this->art = ''; $this->freigabe = ''; $this->entwurf = ''; $this->fassung = ''; $this->nutzung = ''; $this->saeule = ''; $this->einordnung = ''; $this->verarbeitung = ''; $this->archiv = 'aktiv'; } /** * @return array */ private function libraryFilters(): array { return [ 'suche' => $this->suche, 'art' => $this->art, 'freigabe' => $this->freigabe, 'entwurf' => $this->entwurf, 'fassung' => $this->fassung, 'nutzung' => $this->nutzung, 'saeule' => $this->saeule, 'einordnung' => $this->einordnung, 'verarbeitung' => $this->verarbeitung, 'archiv' => $this->archiv, ]; } protected function getHeaderActions(): array { return [ Action::make('create') ->label('Medium anlegen') ->visible(fn (): bool => ContentElementResource::editor()) ->modalDescription('Dieselbe Maske gilt im Medienbestand, im Modul und im Programm. Der Upload zeigt seinen Fortschritt. Beschreibung, Hinweise und Vorschaubild gehören dazu.') ->schema(fn (): array => MediumForm::fields(creating: true)) ->action(function (array $data): void { $element = null; $this->report(function () use ($data, &$element): void { $element = MediumForm::create($data, hold: false); }, 'Das Medium ist angelegt.'); if ($element !== null) { $this->redirect(ContentElementResource::getUrl('view', ['record' => $element])); } }), ]; } }