diff --git a/languages/ar.ini b/languages/ar.ini index bcdf3cfa487..11923b9fdd4 100644 --- a/languages/ar.ini +++ b/languages/ar.ini @@ -1417,7 +1417,6 @@ What am I looking at = "ما الذي أنظر إليه؟" widen_prefix = "حاول توسيع بحثك إلى" wiki_link = "مقدم من ويكيبيديا" with filters = "بالمنقحات" -with_selected = "بالمحدد" Year of Publication = "سنة النشر" Yesterday = "الأمس" You do not have any fines = "لا توجد لديك أي غرامات" diff --git a/languages/bn.ini b/languages/bn.ini index 085d0a70831..a4b143a6c44 100644 --- a/languages/bn.ini +++ b/languages/bn.ini @@ -1418,7 +1418,6 @@ What am I looking at = "এখানে আমি কি খুঁজছি?" widen_prefix = "আপনার সন্ধানকে প্রসারের চেষ্টা করুন" wiki_link = "উইকিপিডিয়া দ্বারা উপলব্ধ" with filters = "ফিল্টার দিয়ে" -with_selected = "নির্বাচিত" Year of Publication = "প্রকাশনার বছর" Yesterday = "গতকাল" You do not have any fines = "আপনার কোন জরিমানা নেই" diff --git a/languages/ca.ini b/languages/ca.ini index 2eea9cfbdb9..fb08a37f60d 100644 --- a/languages/ca.ini +++ b/languages/ca.ini @@ -1410,7 +1410,6 @@ What am I looking at = "Què estic cercant?" widen_prefix = "Amplia la teva cerca a" wiki_link = "Proporcionat per Wikipedia" with filters = "amb filtres" -with_selected = "amb seleccionats" Year of Publication = "Any de publicació" Yesterday = "Ahir" You do not have any fines = "No teniu cap sanció" diff --git a/languages/cs.ini b/languages/cs.ini index 743b389df8a..98ee7f76dd6 100755 --- a/languages/cs.ini +++ b/languages/cs.ini @@ -1415,7 +1415,6 @@ What am I looking at = "Co to znamená?" widen_prefix = "Zkuste rozšířit hledání na" wiki_link = "Získáno z Wikipedie" with filters = "S omezeními" -with_selected = "Vybrané" Year of Publication = "Rok vydání" Yesterday = "Od včerejška" You do not have any fines = "Nemáte žádné upomínky" diff --git a/languages/cy.ini b/languages/cy.ini index e7b8c80d1b8..a8be8d407ee 100644 --- a/languages/cy.ini +++ b/languages/cy.ini @@ -1276,7 +1276,6 @@ What am I looking at = "Ar beth ydw i'n edrych?" widen_prefix = "Cewch geisio ehangu'ch chwiliad i" wiki_link = "Darparwyd gan Wikipedia" with filters = "gyda hidlwyr" -with_selected = "gan detholion" Year of Publication = "Blwyddyn Gyhoeddi" Yesterday = "Ddoe" You do not have any fines = "Nid oes gennych unrhyw ddirwyon" diff --git a/languages/da.ini b/languages/da.ini index d556b41789a..d9e97fa7a1b 100644 --- a/languages/da.ini +++ b/languages/da.ini @@ -669,7 +669,6 @@ wcterms_narrower = "Snævrere emneområde" Web = "Web" wiki_link = "Fra Wikipedia" with filters = "med filtre" -with_selected = "med valgte" Year of Publication = "Udgivelsesår" Yesterday = "Igår" You do not have any fines = "Du har ingen bøder" diff --git a/languages/de.ini b/languages/de.ini index 6d4e36ec32f..d4d64ae3e5e 100644 --- a/languages/de.ini +++ b/languages/de.ini @@ -1184,7 +1184,13 @@ See also = "Siehe auch" see_all_ellipsis = "Alle anzeigen …" Select this record = "Datensatz auswählen" Select your carrier = "Wählen Sie Ihren Telefonanbieter aus" +select_all_on_page = "Alle Einträge der Seite auswählen" +select_item_checked_out_renew = "Titel zum Verlängern auswählen" +select_item_hold_cancel = "Bestellung oder Vormerkung für weitere Aktion auswählen" +select_item_ill_request_cancel = "Titel auswählen, um Fernleihanfrage zu stornieren" +select_item_storage_retrieval_request_cancel = "Titel auswählen, um Magazinbestellung zu stornieren" select_page = "Alles auswählen" +select_page_cart = "Alle Einträge der Zwischenablage auswählen" select_pickup_location = "Abholort auswählen" select_request_group = "Abholstelle auswählen" Selected = "Ausgewählt" @@ -1416,7 +1422,6 @@ What am I looking at = "Wie funktioniert das?" widen_prefix = "Versuchen Sie die Suche auszuweiten nach" wiki_link = "Veröffentlicht in Wikipedia" with filters = "mit Suchfiltern" -with_selected = "Auswahl" Year of Publication = "Erscheinungsjahr" Yesterday = "Gestern" You do not have any fines = "Es sind keine Gebühren auf Ihrem Bibliothekskonto" diff --git a/languages/el.ini b/languages/el.ini index c8c23a5e357..d8626989f8a 100644 --- a/languages/el.ini +++ b/languages/el.ini @@ -1417,7 +1417,6 @@ What am I looking at = "Τι είναι αυτό που βλέπω;" widen_prefix = "Διευρύνετε την έρευνά σας σε" wiki_link = "Παρέχεται από τη Wikipedia" with filters = "με φίλτρα" -with_selected = "με τα επιλεγμένα" Year of Publication = "Έτος έκδοσης" Yesterday = "Χτες" You do not have any fines = "Δεν έχετε πρόστιμα" diff --git a/languages/en.ini b/languages/en.ini index e6aded1771b..53fd8a5dfa8 100644 --- a/languages/en.ini +++ b/languages/en.ini @@ -1184,7 +1184,13 @@ See also = "See also" see_all_ellipsis = "see all…" Select this record = "Select this record" Select your carrier = "Select your carrier" +select_all_on_page = "Select all items on the page" +select_item_checked_out_renew = "Select item for renewing" +select_item_hold_cancel = "Select hold or recall for further action" +select_item_ill_request_cancel = "Select item for canceling interlibrary loan requests" +select_item_storage_retrieval_request_cancel = "Select item for canceling storage retrieval requests" select_page = "Select Page" +select_page_cart = "Select all items in the Book Bag" select_pickup_location = "Select Pick Up Location" select_request_group = "Select Request Group" Selected = "Selected" @@ -1416,7 +1422,6 @@ What am I looking at = "What am I looking at?" widen_prefix = "Try widening your search to" wiki_link = "Provided by Wikipedia" with filters = "with filters" -with_selected = "with selected" Year of Publication = "Year of Publication" Yesterday = "Yesterday" You do not have any fines = "You do not have any fines" diff --git a/languages/es.ini b/languages/es.ini index 765ca0a648e..94f74ab21ea 100644 --- a/languages/es.ini +++ b/languages/es.ini @@ -1417,7 +1417,6 @@ What am I looking at = "¿Qué estoy viendo?" widen_prefix = "Intente ampliando su búsqueda a" wiki_link = "proporcionado por Wikipedia" with filters = "con filtros" -with_selected = "Con selección" Year of Publication = "Año de Publicación" Yesterday = "Ayer" You do not have any fines = "Usted no tiene multas" diff --git a/languages/eu.ini b/languages/eu.ini index 201c022147e..ae1e57139e6 100644 --- a/languages/eu.ini +++ b/languages/eu.ini @@ -1753,7 +1753,6 @@ What am I looking at = "Zer ikusten ari naiz?" widen_prefix = "Saia zaitez zure bilaketa zabaltzen honekin" wiki_link = "Wikipediatik informazioa lortu" with filters = "iragazkiekin" -with_selected = "Con selección" Year of Publication = "Argitaratze-urtea" Yesterday = "Atzo" You do not have any fines = "Ez daukazu isunik" diff --git a/languages/fi.ini b/languages/fi.ini index cfec485316e..8b90756d246 100644 --- a/languages/fi.ini +++ b/languages/fi.ini @@ -1415,7 +1415,6 @@ What am I looking at = "Mitä tämä on?" widen_prefix = "Kokeile laajentaa hakua:" wiki_link = "Wikipedian tuottama" with filters = "suodattimilla" -with_selected = "valituille" Year of Publication = "Julkaisuvuosi" Yesterday = "Eilisestä" You do not have any fines = "Ei maksamattomia maksuja" diff --git a/languages/fr.ini b/languages/fr.ini index b35f0551298..373090f707e 100644 --- a/languages/fr.ini +++ b/languages/fr.ini @@ -1416,7 +1416,6 @@ What am I looking at = "Comment cela fonctionne-t-il ?" widen_prefix = "Veuillez élargir votre recherche" wiki_link = "Informations fournies par Wikipedia" with filters = "avec filtres" -with_selected = "avec la sélection" Year of Publication = "Année de publication" Yesterday = "Hier" You do not have any fines = "Vous n'avez pas d'amende" diff --git a/languages/ga.ini b/languages/ga.ini index a2708a8a917..e073ac58b51 100644 --- a/languages/ga.ini +++ b/languages/ga.ini @@ -1325,7 +1325,6 @@ What am I looking at = "Céard air a bhfuil mé ag breathnú?" widen_prefix = "Bain triail as do chuardach a leathnú go" wiki_link = "Arna chur ar fáil ag Vicipéid" with filters = "le scagairí" -with_selected = "lena bhfuil roghnaithe" Year of Publication = "Bliain a fhoilsithe" Yesterday = "Inné" You do not have any fines = "Níl aon fhíneálacha agat" diff --git a/languages/he.ini b/languages/he.ini index dec2856d0c7..f880cb063b1 100644 --- a/languages/he.ini +++ b/languages/he.ini @@ -767,7 +767,6 @@ Web = "אינטרנט" widen_prefix = "נסו להרחיב את החיפוש ל" wiki_link = "באדיבות וויקיפדיה" with filters = "עם מסננים" -with_selected = "עם פריטים מסומנים" Year of Publication = "שנת הוצאה לאור" Yesterday = "אתמול" You do not have any fines = "אין לך שום קנסות" diff --git a/languages/hi.ini b/languages/hi.ini index 6e1a54823ce..36d365a5174 100644 --- a/languages/hi.ini +++ b/languages/hi.ini @@ -1418,7 +1418,6 @@ What am I looking at = "मेरी नज़र किस पर है ? " widen_prefix = "अपनी खोज को विस्तृत करने का प्रयास करें" wiki_link = "विकिपीडिया द्वारा प्रदान किया गया" with filters = "फ़िल्टर के साथ" -with_selected = "चुनिन्दा के साथ" Year of Publication = "प्रकाशन का वर्ष " Yesterday = "बिता कल" You do not have any fines = "आपके पास कोई जुर्माना नहीं है" diff --git a/languages/hr.ini b/languages/hr.ini index c268b03768d..22439e0ee0a 100644 --- a/languages/hr.ini +++ b/languages/hr.ini @@ -1417,7 +1417,6 @@ What am I looking at = "Što gledam?" widen_prefix = "Pokušaj proširiti pretragu na" wiki_link = "Omogućuje Wikipedia" with filters = "s filtrima" -with_selected = "s odabirom" Year of Publication = "Godina izdanja" Yesterday = "Jučer" You do not have any fines = "Nemaš zakasnina" diff --git a/languages/hy.ini b/languages/hy.ini index 83f720f88f5..7f0e29ad09b 100644 --- a/languages/hy.ini +++ b/languages/hy.ini @@ -1416,7 +1416,6 @@ What am I looking at = "Ինչի՞ն եմ նայում։" widen_prefix = "Փորձեք ընդլայնել ձեր որոնումը դեպի" wiki_link = "Տրամադրված է Վիքիպեդիայի կողմից" with filters = "զտիչներով" -with_selected = "ընտրվածի հետ" Year of Publication = "Հրատարակման տարի" Yesterday = "Երեկ" You do not have any fines = "Դուք տուգանքներ չունեք" diff --git a/languages/it.ini b/languages/it.ini index 523ccfb02f9..961cab8f145 100644 --- a/languages/it.ini +++ b/languages/it.ini @@ -1416,7 +1416,6 @@ What am I looking at = "Che cosa sto cercando?" widen_prefix = "Prova anche ad ampliare la ricerca" wiki_link = "da Wikipedia" with filters = "con filtri" -with_selected = "con i selezionati" Year of Publication = "Anno di pubblicazione" Yesterday = "Ieri" You do not have any fines = "Non hai alcuna sanzione" diff --git a/languages/ja.ini b/languages/ja.ini index b8cbdf49fe7..aedd729c871 100644 --- a/languages/ja.ini +++ b/languages/ja.ini @@ -1417,7 +1417,6 @@ What am I looking at = "現在の検索対象" widen_prefix = "検索範囲を拡大" wiki_link = "Wikipediaによる" with filters = "フィルター適用" -with_selected = "選択資料の処理" Year of Publication = "出版年" Yesterday = "昨日" You do not have any fines = "延滞金はありません" diff --git a/languages/nl.ini b/languages/nl.ini index ba97c8cf6ea..b060cf9289b 100644 --- a/languages/nl.ini +++ b/languages/nl.ini @@ -1320,7 +1320,6 @@ What am I looking at = "Waar kijk ik naar?" widen_prefix = "Probeer jouw zoekopdracht te verbreden naar" wiki_link = "Door Wikipedia aangeleverd" with filters = "met filters" -with_selected = "met geselecteerde" Year of Publication = "Publicatiejaar" Yesterday = "Gisteren" You do not have any fines = "Je hebt geen boetes uitstaan" diff --git a/languages/pl.ini b/languages/pl.ini index ba508b29b97..153e9dc439b 100644 --- a/languages/pl.ini +++ b/languages/pl.ini @@ -1381,7 +1381,6 @@ What am I looking at = "Na co patrzę?" widen_prefix = "Rozszerz wyszukiwanie o" wiki_link = "Źródło: Wikipedia" with filters = "z filtrami" -with_selected = "Zaznaczone" Year of Publication = "Rok wydania" Yesterday = "Wczoraj" You do not have any fines = "Nie masz opłat na twoim koncie" diff --git a/languages/pt-br.ini b/languages/pt-br.ini index 500eed1f047..9a25023750f 100644 --- a/languages/pt-br.ini +++ b/languages/pt-br.ini @@ -1416,7 +1416,6 @@ What am I looking at = "O que eu estou olhando?" widen_prefix = "Tente ampliar a sua busca a" wiki_link = "Fornecido pela Wikipedia" with filters = "com os filtros" -with_selected = "selecionados" Year of Publication = "Ano de Publicação" Yesterday = "Ontem" You do not have any fines = "Você não tem quaisquer multas" diff --git a/languages/pt.ini b/languages/pt.ini index 0a21450c4b8..7da35bf733b 100644 --- a/languages/pt.ini +++ b/languages/pt.ini @@ -992,7 +992,6 @@ What am I looking at = "O que é isto?" widen_prefix = "Tente alargar a sua pesquisa a" wiki_link = "Fornecido pela Wikipedia" with filters = "com os filtros" -with_selected = "selecionados" Year of Publication = "Ano de Publicação" Yesterday = "Ontem" You do not have any fines = "Você não tem quaisquer multas" diff --git a/languages/ru.ini b/languages/ru.ini index 64c0eba657a..2a093c42858 100644 --- a/languages/ru.ini +++ b/languages/ru.ini @@ -1433,7 +1433,6 @@ What am I looking at = "Что я ищу?" widen_prefix = "Попытайтесь расширить свой поиск" wiki_link = "Предоставлено Wikipedia" with filters = "с фильтрами" -with_selected = "с выбранными" Year of Publication = "Дата издания" Yesterday = "Вчера" You do not have any fines = "У Вас нет штафов" diff --git a/languages/sl.ini b/languages/sl.ini index 79d4a1f6b4e..c0b0a03b942 100644 --- a/languages/sl.ini +++ b/languages/sl.ini @@ -823,7 +823,6 @@ Web = "Splet" widen_prefix = "Poizkusite razširiti vaše iskanje" wiki_link = "V Wikipediji" with filters = "s filtri" -with_selected = "z izbranim" Year of Publication = "Leto izdaje" Yesterday = "Včeraj" You do not have any fines = "Nimate zamudnin" diff --git a/languages/sv.ini b/languages/sv.ini index 3965970e992..0e8e1941dcf 100644 --- a/languages/sv.ini +++ b/languages/sv.ini @@ -1415,7 +1415,6 @@ What am I looking at = "Vad tittar jag på?" widen_prefix = "Pröva att utvidga sökningen:" wiki_link = "Levererad av Wikipedia" with filters = "med filter" -with_selected = "med valda" Year of Publication = "Utgivningsår" Yesterday = "Från igår" You do not have any fines = "Du har inga obetalda avgifter" diff --git a/languages/tr.ini b/languages/tr.ini index 6df33f581aa..41a55a978a4 100644 --- a/languages/tr.ini +++ b/languages/tr.ini @@ -1470,7 +1470,6 @@ What am I looking at = "Neye Bakıyorum?" widen_prefix = "Aramanızı genişletmeyi deneyin." wiki_link = "Yukarıdaki bilgiler Wikipedia'dan alınmıştır" with filters = "Filitreleme" -with_selected = "seçilmiş olan" Year of Publication = "Yayın Tarihi" Yesterday = "Dün" You do not have any fines = "Geçikme cezanız yoktur" diff --git a/languages/uk.ini b/languages/uk.ini index d33fdec9b53..efba229f3a3 100644 --- a/languages/uk.ini +++ b/languages/uk.ini @@ -1416,7 +1416,6 @@ What am I looking at = "Що я шукаю?" widen_prefix = "Спробуйте розширити Ваш пошук до" wiki_link = "Надано: Wikipedia" with filters = "з фільтрами" -with_selected = "з відміченими" Year of Publication = "Рік видання" Yesterday = "Вчора" You do not have any fines = "Ви не маєте пені" diff --git a/languages/vi.ini b/languages/vi.ini index 033aa16809b..b890a48ccc4 100644 --- a/languages/vi.ini +++ b/languages/vi.ini @@ -1314,7 +1314,6 @@ What am I looking at = "Tôi đang nhìn cái gì thế này?" widen_prefix = "Thử mở rộng tìm kiếm của bạn thành" wiki_link = "Được cung cấp bởi Wikipedia" with filters = "với bộ lọc" -with_selected = "với đã chọn" Year of Publication = "Năm xuất bản" Yesterday = "Hôm qua" You do not have any fines = "Bạn không có tiền phạt nào" diff --git a/languages/zh-cn.ini b/languages/zh-cn.ini index 022c23292ce..00ea85c6c23 100644 --- a/languages/zh-cn.ini +++ b/languages/zh-cn.ini @@ -788,7 +788,6 @@ wcterms_narrower = "更确切主题" Web = "网站" wiki_link = "维基百科提供" with filters = "带过滤器" -with_selected = "与选定的" Year of Publication = "出版年" Yesterday = "昨天" You do not have any fines = "您没有任何罚款" diff --git a/languages/zh.ini b/languages/zh.ini index 9736ca48713..38f802196b8 100644 --- a/languages/zh.ini +++ b/languages/zh.ini @@ -654,7 +654,6 @@ wcterms_narrower = "更確切主題" Web = "網站" wiki_link = "維基百科提供" with filters = "帶過濾器" -with_selected = "與選定的" Year of Publication = "出版年" Yesterday = "昨天" You do not have any fines = "您沒有任何罰款" diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Record.php b/module/VuFind/src/VuFind/View/Helper/Root/Record.php index 0a0ade175a1..b7a5f0c7670 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Record.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Record.php @@ -29,6 +29,7 @@ namespace VuFind\View\Helper\Root; +use Laminas\View\Helper\ViewModel; use VuFind\Cover\Router as CoverRouter; /** @@ -58,6 +59,13 @@ class Record extends \Laminas\View\Helper\AbstractHelper */ protected $coverRouter = null; + /** + * ViewModel helper + * + * @var ViewModel + */ + protected $viewModel = null; + /** * Record driver * @@ -94,6 +102,18 @@ public function setCoverRouter($router) $this->coverRouter = $router; } + /** + * Inject the layout helper + * + * @param ViewModel $viewModel layout view helper + * + * @return void + */ + public function setViewModelHelper(ViewModel $viewModel) + { + $this->viewModel = $viewModel; + } + /** * Render a template within a record driver folder. * @@ -415,8 +435,7 @@ public function getSearchResult($view) */ public function getCheckbox($idPrefix = '', $formAttr = false, $number = null) { - $id = $this->driver->getSourceIdentifier() . '|' - . $this->driver->getUniqueId(); + $id = $this->getUniqueHtmlElementId($idPrefix); $context = ['id' => $id, 'number' => $number, 'prefix' => $idPrefix]; if ($formAttr) { @@ -707,4 +726,47 @@ protected function deduplicateLinks($links) { return array_values(array_unique($links, SORT_REGULAR)); } + + /** + * Get the source identifier + unique id of the record without spaces + * + * @param string $idPrefix Prefix for HTML ids + * + * @return string + */ + public function getUniqueHtmlElementId($idPrefix = "") + { + if (empty($idPrefix)) { + if ($this->viewModel->getCurrent()->getTemplate()) { + $idPrefix .= str_replace( + DIRECTORY_SEPARATOR, + '-', + $this->viewModel->getCurrent()->getTemplate() + ); + } + } + + if ($this->viewModel->getRoot()->getTemplate() === 'layout/lightbox') { + $idPrefix = 'modal-' . $idPrefix; + } + + return preg_replace( + "/\s+/", + "_", + ($idPrefix ? $idPrefix . '-' : '') . $this->getUniqueIdWithSourcePrefix() + ); + } + + /** + * Get the source identifier + unique id of the record + * + * @return string + */ + public function getUniqueIdWithSourcePrefix() + { + if ($this->driver) { + return "{$this->driver->tryMethod('getSourceIdentifier')}" + . "|{$this->driver->tryMethod('getUniqueId')}"; + } + } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php index 9cfa6f0adb5..f0f56c24a61 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php @@ -72,6 +72,9 @@ public function __invoke( ->get('config'); $helper = new $requestedName($config); $helper->setCoverRouter($container->get(\VuFind\Cover\Router::class)); + $helper->setViewModelHelper( + $container->get('ViewHelperManager')->get('ViewModel') + ); return $helper; } } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordTest.php index 2dfe915e949..d03e5617eac 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordTest.php @@ -361,26 +361,50 @@ public function testGetLink( public function testGetCheckbox() { $context = $this->getMockContext(); - $context->expects($this->exactly(2))->method('renderInContext') + $context->expects($this->exactly(5))->method('renderInContext') ->withConsecutive( [ 'record/checkbox.phtml', - ['id' => 'Solr|000105196', 'number' => 1, 'prefix' => 'bar', 'formAttr' => 'foo'], + ['id' => 'bar-Solr|000105196', 'number' => 1, 'prefix' => 'bar', 'formAttr' => 'foo'], ], [ 'record/checkbox.phtml', - ['id' => 'Solr|000105196', 'number' => 2, 'prefix' => 'bar', 'formAttr' => 'foo'], + ['id' => 'bar-Solr|000105196', 'number' => 2, 'prefix' => 'bar', 'formAttr' => 'foo'], + ], + [ + 'record/checkbox.phtml', + ['id' => 'modal-bar-Solr|000105196', 'number' => 3, 'prefix' => 'bar', 'formAttr' => 'foo'], + ], + [ + 'record/checkbox.phtml', + ['id' => 'baz-Solr|000105196', 'number' => 4, 'prefix' => '', 'formAttr' => 'foo'], + ], + [ + 'record/checkbox.phtml', + ['id' => 'modal-baz-Solr|000105196', 'number' => 5, 'prefix' => '', 'formAttr' => 'foo'], ] ) - ->willReturnOnConsecutiveCalls('success', 'success'); + ->willReturnOnConsecutiveCalls('success', 'success', 'success', 'success', 'success'); $record = $this->getRecord( $this->loadRecordFixture('testbug1.json'), [], $context ); - // We run the test twice to ensure that checkbox incrementing works properly: + // We run the test with custom prefix twice to ensure that checkbox incrementing works properly: $this->assertEquals('success', $record->getCheckbox('bar', 'foo', 1)); $this->assertEquals('success', $record->getCheckbox('bar', 'foo', 2)); + + // custom prefix in lightbox + $record->setViewModelHelper($this->getMockViewModel('', 'layout/lightbox')); + $this->assertEquals('success', $record->getCheckbox('bar', 'foo', 3)); + + // default prefix (from template name) + $record->setViewModelHelper($this->getMockViewModel('baz', '')); + $this->assertEquals('success', $record->getCheckbox('', 'foo', 4)); + + // default prefix in lightbox + $record->setViewModelHelper($this->getMockViewModel('baz', 'layout/lightbox')); + $this->assertEquals('success', $record->getCheckbox('', 'foo', 5)); } /** @@ -661,6 +685,7 @@ protected function getRecord( $config = is_array($config) ? new \Laminas\Config\Config($config) : $config; $record = new Record($config); $record->setCoverRouter(new \VuFind\Cover\Router('http://foo/bar', $this->getCoverLoader())); + $record->setViewModelHelper($this->getMockViewModel()); $record->setView($view); return $record($driver); } @@ -735,6 +760,37 @@ protected function getMockSearchTabs($setDefaultExpectations = true) return $searchTabs; } + /** + * Get a mock of view model helper + * + * @param string $currentTemplate Current template name + * @param string $rootTemplate Root template name + * + * @return \Laminas\View\Helper\ViewModel + */ + protected function getMockViewModel(string $currentTemplate = '', string $rootTemplate = '') + { + $helperMock = $this->getMockBuilder(\Laminas\View\Helper\ViewModel::class) + ->disableOriginalConstructor() + ->getMock(); + $currentModelMock = $this->getMockBuilder(\Laminas\View\Model\ViewModel::class) + ->disableOriginalConstructor() + ->getMock(); + $currentModelMock->expects($this->any())->method('getTemplate') + ->will($this->returnValue($currentTemplate)); + + $rootModelMock = $this->getMockBuilder(\Laminas\View\Model\ViewModel::class) + ->disableOriginalConstructor() + ->getMock(); + $rootModelMock->expects($this->any())->method('getTemplate') + ->will($this->returnValue($rootTemplate)); + + $helperMock->expects($this->any())->method('getCurrent')->will($this->returnValue($currentModelMock)); + $helperMock->expects($this->any())->method('getRoot')->will($this->returnValue($rootModelMock)); + + return $helperMock; + } + /** * Load a fixture file. * diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/list-entry.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/list-entry.phtml index fdbacfcb898..251dfecd4a8 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/list-entry.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/list-entry.phtml @@ -14,6 +14,7 @@ $cover = $coverDetails['html']; $thumbnail = false; $thumbnailAlignment = $this->record($this->driver)->getThumbnailAlignment('list'); + $describedById = $this->record($this->driver)->getUniqueHtmlElementId(); ?>
  • driver instanceof \VuFind\RecordDriver\Missing; ?> - record($this->driver)->getTitleHtml()?> + record($this->driver)->getTitleHtml()?> driver->tryMethod('getTitlesAltScript', [], []) as $altTitle): ?>
    diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml index 3b98792ffb8..69d1c61d3e1 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml @@ -4,6 +4,7 @@ $cover = $coverDetails['html']; $thumbnail = false; $thumbnailAlignment = $this->record($this->driver)->getThumbnailAlignment('result'); + $describedById = $this->record($this->driver)->getUniqueHtmlElementId(); if ($cover): ob_start(); ?>
    @@ -21,7 +22,7 @@
    - + record($this->driver)->getTitleHtml()?> driver->tryMethod('getTitlesAltScript', [], []) as $altTitle): ?> @@ -173,13 +174,13 @@ record($this->driver)->renderTemplate('controls/qrcode.phtml', ['driver' => $this->driver, 'context' => 'results'])?> cart()->isActiveInSearch() && isset($this->params) && $this->params->getOptions()->supportsCart() && $this->cart()->isActive()): ?> - render('record/cart-buttons.phtml', ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier()]); ?>
    + render('record/cart-buttons.phtml', ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier()]); ?>
    userlist()->getMode() !== 'disabled'): ?> permission()->allowDisplay('feature.Favorites')): ?> - + icon('user-favorites', 'icon-link__icon') ?> transEsc('Add to favorites')?>
    @@ -197,7 +198,7 @@ $hierarchyTitle): ?>
  • diff --git a/themes/bootstrap3/templates/holds/list.phtml b/themes/bootstrap3/templates/holds/list.phtml index b796f4c1744..289b7d749ef 100644 --- a/themes/bootstrap3/templates/holds/list.phtml +++ b/themes/bootstrap3/templates/holds/list.phtml @@ -28,7 +28,7 @@
    updateForm): ?>
    @@ -62,6 +62,7 @@ recordList as $resource): ?> getExtraDetail('ils_details'); ?> + record($resource)->getUniqueHtmlElementId(); ?>
  • cancelForm && isset($ilsDetails['cancel_details'])) || ($this->updateForm && isset($ilsDetails['updateDetails']))): ?> @@ -70,7 +71,7 @@
    cancelForm || $this->updateForm): ?> @@ -103,11 +104,11 @@ if (is_a($resource, 'VuFind\\RecordDriver\\SolrDefault') && !is_a($resource, 'VuFind\\RecordDriver\\Missing')) { $title = $resource->getTitle(); $title = empty($title) ? $this->transEsc('Title not available') : $this->escapeHtml($title); - echo '' . $title . ''; } elseif (isset($ilsDetails['title']) && !empty($ilsDetails['title'])) { // If the record is not available in Solr, perhaps the ILS driver sent us a title we can show... - echo '' . $this->escapeHtml($ilsDetails['title']) . ''; + echo '' . $this->escapeHtml($ilsDetails['title']) . ''; } else { // Last resort -- indicate that no title could be found. echo $this->transEsc('Title not available'); diff --git a/themes/bootstrap3/templates/myresearch/bulk-action-buttons.phtml b/themes/bootstrap3/templates/myresearch/bulk-action-buttons.phtml index c6e7641ea3a..9656818e10d 100644 --- a/themes/bootstrap3/templates/myresearch/bulk-action-buttons.phtml +++ b/themes/bootstrap3/templates/myresearch/bulk-action-buttons.phtml @@ -6,7 +6,7 @@