X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=application%2Ffront%2Fcontroller%2Fvisitor%2FPictureWallController.php;h=9c8f07d7a18e07990c1a488224563e1ec199d104;hb=9b8c0a4560fa1d87cab1529099b1b4677e92e265;hp=4e1dce8c9b31411cadcd0b1a4fe72ffb540c6e19;hpb=2899ebb5b5e82890c877151f5c02045266ac9973;p=github%2Fshaarli%2FShaarli.git diff --git a/application/front/controller/visitor/PictureWallController.php b/application/front/controller/visitor/PictureWallController.php index 4e1dce8c..9c8f07d7 100644 --- a/application/front/controller/visitor/PictureWallController.php +++ b/application/front/controller/visitor/PictureWallController.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; use Shaarli\Front\Exception\ThumbnailsDisabledException; +use Shaarli\Render\TemplatePage; use Shaarli\Thumbnailer; use Slim\Http\Request; use Slim\Http\Response; @@ -25,46 +26,29 @@ class PictureWallController extends ShaarliVisitorController $this->assignView( 'pagetitle', - t('Picture wall') .' - '. $this->container->conf->get('general.title', 'Shaarli') + t('Picture wall') . ' - ' . $this->container->conf->get('general.title', 'Shaarli') ); // Optionally filter the results: - $links = $this->container->bookmarkService->search($request->getQueryParams()); - $linksToDisplay = []; + $bookmarks = $this->container->bookmarkService->search($request->getQueryParams())->getBookmarks(); + $links = []; // Get only bookmarks which have a thumbnail. // Note: we do not retrieve thumbnails here, the request is too heavy. $formatter = $this->container->formatterFactory->getFormatter('raw'); - foreach ($links as $key => $link) { - if (!empty($link->getThumbnail())) { - $linksToDisplay[] = $formatter->format($link); + foreach ($bookmarks as $key => $bookmark) { + if (!empty($bookmark->getThumbnail())) { + $links[] = $formatter->format($bookmark); } } - $data = $this->executeHooks($linksToDisplay); + $data = ['linksToDisplay' => $links]; + $this->executePageHooks('render_picwall', $data, TemplatePage::PICTURE_WALL); + foreach ($data as $key => $value) { $this->assignView($key, $value); } - return $response->write($this->render('picwall')); - } - - /** - * @param mixed[] $linksToDisplay List of formatted bookmarks - * - * @return mixed[] Template data after active plugins render_picwall hook execution. - */ - protected function executeHooks(array $linksToDisplay): array - { - $data = [ - 'linksToDisplay' => $linksToDisplay, - ]; - $this->container->pluginManager->executeHooks( - 'render_picwall', - $data, - ['loggedin' => $this->container->loginManager->isLoggedIn()] - ); - - return $data; + return $response->write($this->render(TemplatePage::PICTURE_WALL)); } }