From c78ebb8ce3a11635fe8d98c05f6e23dd4395b0b6 Mon Sep 17 00:00:00 2001 From: Aleksi Peebles Date: Tue, 1 Aug 2023 15:42:06 +0300 Subject: [PATCH] Use double @ for Finna components --- .../src/Finna/View/Helper/Root/Component.php | 4 ++-- .../templates/Helpers/bazaar-browse-bar.phtml | 2 +- .../DefaultRecord/list-entry.phtml | 2 +- .../RecordDriver/EDS/list-entry.phtml | 2 +- .../RecordDriver/Primo/list-entry.phtml | 2 +- .../RecordDriver/SolrLido/list-entry.phtml | 2 +- .../finna2/templates/myresearch/mylist.phtml | 2 +- .../organisationinfo/home-consortium.phtml | 4 ++-- .../organisationinfo/map-information.phtml | 18 +++++++++--------- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/module/Finna/src/Finna/View/Helper/Root/Component.php b/module/Finna/src/Finna/View/Helper/Root/Component.php index bc3f5832c11..5f2329265cc 100644 --- a/module/Finna/src/Finna/View/Helper/Root/Component.php +++ b/module/Finna/src/Finna/View/Helper/Root/Component.php @@ -50,12 +50,12 @@ class Component extends \VuFind\View\Helper\Root\Component */ public function __invoke(string $name, $params = []): string { - if ($name[0] !== '@') { + if (!str_starts_with($name, '@@')) { return parent::__invoke($name, $params); } $parts = explode('/', $name); - $path = substr(array_shift($parts), 1); + $path = substr(array_shift($parts), 2); $name = implode('/', $parts); return $this->view->render("components/$path/" . $name, $params); diff --git a/themes/finna2/templates/Helpers/bazaar-browse-bar.phtml b/themes/finna2/templates/Helpers/bazaar-browse-bar.phtml index 9b2975c59e4..22c47d1749d 100644 --- a/themes/finna2/templates/Helpers/bazaar-browse-bar.phtml +++ b/themes/finna2/templates/Helpers/bazaar-browse-bar.phtml @@ -1,5 +1,5 @@ -component('@organisms/navigation/finna-bazaar-browse-bar', [ +component('@@organisms/navigation/finna-bazaar-browse-bar', [ 'addResourceCallbackPayload' => $this->bazaarSession()->getAddResourceCallbackPayload(), 'addResourceCallbackUrl' => $this->bazaarSession()->getAddResourceCallbackUrl(), 'cancelUrl' => $this->bazaarSession()->getCancelUrl(), diff --git a/themes/finna2/templates/RecordDriver/DefaultRecord/list-entry.phtml b/themes/finna2/templates/RecordDriver/DefaultRecord/list-entry.phtml index 11a5e6b0084..40dedcb2fd1 100644 --- a/themes/finna2/templates/RecordDriver/DefaultRecord/list-entry.phtml +++ b/themes/finna2/templates/RecordDriver/DefaultRecord/list-entry.phtml @@ -150,7 +150,7 @@
transEsc('Note')?>:
markdown()->replaceDeprecatedTags($notes) : ''; ?> - component('@organisms/widgets/finna-md-editable', [ + component('@@organisms/widgets/finna-md-editable', [ 'attributes' => ['class' => 'resource-note'], 'markdown' => $markdown, 'html' => $markdown ? $this->markdown()->toHtml($markdown, false) : '', diff --git a/themes/finna2/templates/RecordDriver/EDS/list-entry.phtml b/themes/finna2/templates/RecordDriver/EDS/list-entry.phtml index 37f851d20a4..fa35131a994 100644 --- a/themes/finna2/templates/RecordDriver/EDS/list-entry.phtml +++ b/themes/finna2/templates/RecordDriver/EDS/list-entry.phtml @@ -125,7 +125,7 @@
transEsc('Note')?>:
markdown()->replaceDeprecatedTags($notes) : ''; ?> - component('@organisms/widgets/finna-md-editable', [ + component('@@organisms/widgets/finna-md-editable', [ 'attributes' => ['class' => 'resource-note'], 'markdown' => $markdown, 'html' => $markdown ? $this->markdown()->toHtml($markdown, false) : '', diff --git a/themes/finna2/templates/RecordDriver/Primo/list-entry.phtml b/themes/finna2/templates/RecordDriver/Primo/list-entry.phtml index 7b2c4a3c1d7..4852ebd304e 100644 --- a/themes/finna2/templates/RecordDriver/Primo/list-entry.phtml +++ b/themes/finna2/templates/RecordDriver/Primo/list-entry.phtml @@ -125,7 +125,7 @@
transEsc('Note')?>:
markdown()->replaceDeprecatedTags($notes) : ''; ?> - component('@organisms/widgets/finna-md-editable', [ + component('@@organisms/widgets/finna-md-editable', [ 'attributes' => ['class' => 'resource-note'], 'markdown' => $markdown, 'html' => $markdown ? $this->markdown()->toHtml($markdown, false) : '', diff --git a/themes/finna2/templates/RecordDriver/SolrLido/list-entry.phtml b/themes/finna2/templates/RecordDriver/SolrLido/list-entry.phtml index 5b7ba88380d..929f7286729 100644 --- a/themes/finna2/templates/RecordDriver/SolrLido/list-entry.phtml +++ b/themes/finna2/templates/RecordDriver/SolrLido/list-entry.phtml @@ -145,7 +145,7 @@
transEsc('Note')?>:
markdown()->replaceDeprecatedTags($notes) : ''; ?> - component('@organisms/widgets/finna-md-editable', [ + component('@@organisms/widgets/finna-md-editable', [ 'attributes' => ['class' => 'resource-note'], 'markdown' => $markdown, 'html' => $markdown ? $this->markdown()->toHtml($markdown, false) : '', diff --git a/themes/finna2/templates/myresearch/mylist.phtml b/themes/finna2/templates/myresearch/mylist.phtml index e411395a6c6..28111dd624a 100644 --- a/themes/finna2/templates/myresearch/mylist.phtml +++ b/themes/finna2/templates/myresearch/mylist.phtml @@ -58,7 +58,7 @@ markdown()->replaceDeprecatedTags($list->description ?? '') : ''; ?> - component('@organisms/widgets/finna-md-editable', [ + component('@@organisms/widgets/finna-md-editable', [ 'attributes' => ['class' => 'list-description'], 'markdown' => $markdown, 'html' => $markdown ? $this->markdown()->toHtml($markdown, false) : '', diff --git a/themes/finna2/templates/organisationinfo/home-consortium.phtml b/themes/finna2/templates/organisationinfo/home-consortium.phtml index 2f0d9a23dc0..2e43b9c4bb0 100644 --- a/themes/finna2/templates/organisationinfo/home-consortium.phtml +++ b/themes/finna2/templates/organisationinfo/home-consortium.phtml @@ -35,7 +35,7 @@ - component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-default', 'organisation-info-panel']], 'heading' => $this->transEsc('organisation_info_navi_usage'), 'headingLevel' => 4, @@ -57,7 +57,7 @@ - component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-default', 'organisation-info-panel', 'links-panel', 'hide']], 'heading' => $this->transEsc('Links'), 'headingLevel' => 4, diff --git a/themes/finna2/templates/organisationinfo/map-information.phtml b/themes/finna2/templates/organisationinfo/map-information.phtml index 850d51f336f..bd4c24cefcb 100644 --- a/themes/finna2/templates/organisationinfo/map-information.phtml +++ b/themes/finna2/templates/organisationinfo/map-information.phtml @@ -89,7 +89,7 @@

transEsc('organisation_info_building_year')?>:

- component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-borderless', 'introduction']], 'heading' => $this->transEsc('organisation_info_general'), 'headingLevel' => 4, @@ -100,7 +100,7 @@ ]); ?>
- component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-borderless', 'opening-times-library-information']], 'heading' => $this->transEsc('organisation_info_schedules'), 'headingLevel' => 4, @@ -111,7 +111,7 @@ ]); ?>
- component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-borderless', 'contact-details', 'contact-details-rss', 'info-element']], 'heading' => $this->transEsc('organisation_info_contact'), 'headingLevel' => 4, @@ -120,7 +120,7 @@ 'collapseId' => 'collapse3', 'collapsed' => false, ]); ?> - component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-borderless', 'contact-details', 'contact-details-no-rss', 'info-element']], 'heading' => $this->transEsc('organisation_info_contact'), 'headingLevel' => 4, @@ -142,7 +142,7 @@
- component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-borderless', 'services', 'info-element']], 'heading' => $this->transEsc('organisation_info_services'), 'headingLevel' => 4, @@ -152,7 +152,7 @@ 'collapsed' => false, ]); ?> - component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-borderless', 'accessibility-details', 'info-element']], 'heading' => $this->transEsc('organisation_info_accessibility'), 'headingLevel' => 4, @@ -179,7 +179,7 @@
- component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-borderless', 'personnel', 'info-element']], 'heading' => $this->transEsc('organisation_info_staff'), 'headingLevel' => 4, @@ -192,7 +192,7 @@
- component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-borderless', 'news-feed-container', 'rss-container', 'info-element']], 'heading' => $this->transEsc('organisation_info_rss_news'), 'headingLevel' => 4, @@ -203,7 +203,7 @@
- component('@molecules/containers/finna-panel', [ + component('@@molecules/containers/finna-panel', [ 'attributes' => ['class' => ['finna-panel-borderless', 'events-feed-container', 'rss-container', 'info-element']], 'heading' => $this->transEsc('organisation_info_rss_events'), 'headingLevel' => 4,