Ergänzt AJAX-Livesuche für Seiten, Beiträge und Mediathek
CMS quality / php (8.2) (push) Canceled after 0s
CMS quality / php (8.4) (push) Canceled after 0s
CMS quality / browser (push) Canceled after 0s
CMS quality / mysql (push) Canceled after 0s

This commit is contained in:
kantarci committed 2026-09-14 11:09:24 +02:00
1 parent 11b60fc5d8
commit 41d87f62a4
20 files changed
+703 -311

No files matched your search

+13 -5
View File
@@ -24,11 +24,18 @@ final class MediaController extends AbstractController
// The screen renders the images itself, page by page. The dialog stays what it is: the way
// to pick an image while editing, not the way to see what the library holds.
$archived = $request->query->getBoolean('archiv');
$query = mb_substr(trim($request->query->getString('q')), 0, 160);
$library = $this->media->page($request->query->getInt('seite', 1), $archived, query: $query);
$view = ['library' => $library, 'archived' => $archived, 'query' => $query];
if ($request->isXmlHttpRequest()) {
return $this->json([
'html' => $this->renderView('admin/media-results.html.twig', $view),
'total' => $library['total'],
'parameters' => ['q' => $query, 'archiv' => $archived ? '1' : '0', 'seite' => $library['page']],
]);
}
return $this->render('admin/media.html.twig', [
'library' => $this->media->page($request->query->getInt('seite', 1), $archived),
'archived' => $archived,
]);
return $this->render('admin/media.html.twig', $view);
}
#[Route('/%kant.admin_path%/media/upload', name: 'admin_media_upload', methods: ['POST'])]
@@ -90,7 +97,8 @@ final class MediaController extends AbstractController
$query = array_filter([
'seite' => $request->request->getInt('seite', 1) > 1 ? $request->request->getInt('seite') : null,
'archiv' => $request->request->getBoolean('archiv') ? '1' : null,
]);
'q' => mb_substr(trim($request->request->getString('q')), 0, 160),
], static fn ($value): bool => null !== $value && '' !== $value);
return $this->redirectToRoute('admin_media', $query);
}