]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/front/controller/admin/ThumbnailsController.php
Handle pagination through BookmarkService
[github/shaarli/Shaarli.git] / application / front / controller / admin / ThumbnailsController.php
index e53085105e15a0b69a8c0d2faec0f706757a8f74..5dfea0964378a13aaba22516d755137d2e8b734f 100644 (file)
@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace Shaarli\Front\Controller\Admin;
 
 use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
+use Shaarli\Render\TemplatePage;
 use Slim\Http\Request;
 use Slim\Http\Response;
 
@@ -21,7 +22,7 @@ class ThumbnailsController extends ShaarliAdminController
     public function index(Request $request, Response $response): Response
     {
         $ids = [];
-        foreach ($this->container->bookmarkService->search() as $bookmark) {
+        foreach ($this->container->bookmarkService->search()->getBookmarks() as $bookmark) {
             // A note or not HTTP(S)
             if ($bookmark->isNote() || !startsWith(strtolower($bookmark->getUrl()), 'http')) {
                 continue;
@@ -33,10 +34,10 @@ class ThumbnailsController extends ShaarliAdminController
         $this->assignView('ids', $ids);
         $this->assignView(
             'pagetitle',
-            t('Thumbnails update') .' - '. $this->container->conf->get('general.title', 'Shaarli')
+            t('Thumbnails update') . ' - ' . $this->container->conf->get('general.title', 'Shaarli')
         );
 
-        return $response->write($this->render('thumbnails'));
+        return $response->write($this->render(TemplatePage::THUMBNAILS));
     }
 
     /**
@@ -51,7 +52,7 @@ class ThumbnailsController extends ShaarliAdminController
         }
 
         try {
-            $bookmark = $this->container->bookmarkService->get($id);
+            $bookmark = $this->container->bookmarkService->get((int) $id);
         } catch (BookmarkNotFoundException $e) {
             return $response->withStatus(404);
         }
@@ -61,19 +62,4 @@ class ThumbnailsController extends ShaarliAdminController
 
         return $response->withJson($this->container->formatterFactory->getFormatter('raw')->format($bookmark));
     }
-
-    /**
-     * @param mixed[] $data Variables passed to the template engine
-     *
-     * @return mixed[] Template data after active plugins render_picwall hook execution.
-     */
-    protected function executeHooks(array $data): array
-    {
-        $this->container->pluginManager->executeHooks(
-            'render_tools',
-            $data
-        );
-
-        return $data;
-    }
 }