From fc0b217702bfd2526db0049047cb73f12b352789 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Thu, 21 Feb 2019 16:21:17 +0100
Subject: [PATCH] dev #64573 wip on record view

---
 .../Intonation/View/RenderRecord.php          | 31 +++++++++++++++++--
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/library/templates/Intonation/View/RenderRecord.php b/library/templates/Intonation/View/RenderRecord.php
index 338de620d42..b37cd1eb2e6 100644
--- a/library/templates/Intonation/View/RenderRecord.php
+++ b/library/templates/Intonation/View/RenderRecord.php
@@ -126,10 +126,35 @@ class Intonation_View_RenderRecord extends ZendAfi_View_Helper_BaseHelper {
 
 
   protected function _renderRelated() {
+    $callback = function ($record) {
+      $wrapped =
+      (new Intonation_Library_View_Wrapper_Record)
+      ->setView($this->view)
+      ->setModel($record);
+      return $this->view->cardifyWithOverlay($wrapped);
+    };
+
+    $html = [];
+
+    if ($same_series = $this->_record->getNoticesMemeSeries())
+      $html [] = $this->_div(['class' => 'col-12'],
+                             $this->_tag('h2', $this->_('Les documents de la même série'))
+                             . $this->view->renderMultipleCarousel(new Storm_Collection($same_series),
+                                                                   $callback));
+
+    if ($like = $this->_record->getNoticesSimilaires())
+      $html [] = $this->_div(['class' => 'col-12'],
+                             $this->_tag('h2', $this->_('Les similaires'))
+                             . $this->view->renderMultipleCarousel(new Storm_Collection($like),
+                                                                   $callback));
+
+
     return $this->_renderBloc($this->_('Voir Aussi'),
-                              $this->_grid($this->_renderAjaxBloc('series')
-                                           . $this->_renderAjaxBloc('frbr')
-                                           . $this->_renderAjaxBloc('similaires')));
+                              $this->_grid(implode($html)));
+
+    $this->_renderAjaxBloc('series')
+      . $this->_renderAjaxBloc('frbr')
+      . $this->_renderAjaxBloc('similaires');
   }
 
 
-- 
GitLab