From 6e9d68c8d744563ddd91706bfef160f1489093ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eetu=20Mansikkam=C3=A4ki?= Date: Thu, 9 Nov 2023 20:00:28 +0100 Subject: [PATCH] AV-2092: Add faq menus for en and sv --- .../node.type.avoindata_guide_page.yml | 5 ++- .../modules/avoindata-theme/avoindata.theme | 10 +++++ .../config/install/block.block.faqmenuen.yml | 44 +++++++++++++++++++ .../config/install/block.block.faqmenusv.yml | 44 +++++++++++++++++++ .../install/system.menu.faq-menu-en.yml | 7 +++ .../install/system.menu.faq-menu-sv.yml | 7 +++ .../js/cycle_guide_menu_items.js | 8 +++- .../block/block--faqmenuen.html.twig | 1 + .../block/block--faqmenusv.html.twig | 1 + 9 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 drupal/modules/avoindata-theme/config/install/block.block.faqmenuen.yml create mode 100644 drupal/modules/avoindata-theme/config/install/block.block.faqmenusv.yml create mode 100644 drupal/modules/avoindata-theme/config/install/system.menu.faq-menu-en.yml create mode 100644 drupal/modules/avoindata-theme/config/install/system.menu.faq-menu-sv.yml create mode 100644 drupal/modules/avoindata-theme/templates/block/block--faqmenuen.html.twig create mode 100644 drupal/modules/avoindata-theme/templates/block/block--faqmenusv.html.twig diff --git a/drupal/modules/avoindata-guide/config/install/node.type.avoindata_guide_page.yml b/drupal/modules/avoindata-guide/config/install/node.type.avoindata_guide_page.yml index 4ad030a005..c3eb51f294 100644 --- a/drupal/modules/avoindata-guide/config/install/node.type.avoindata_guide_page.yml +++ b/drupal/modules/avoindata-guide/config/install/node.type.avoindata_guide_page.yml @@ -18,6 +18,9 @@ third_party_settings: - operating-model-menu-en - operating-model-menu-fi - operating-model-menu-sv + - faq-menu-en + - faq-menu-fi + - faq-menu-sv parent: 'guide-menu-fi:' _core: default_config_hash: TJ9-xPK8xacrOKUra0l2-DrLJz6nZO7nnq68pl_lT5E @@ -27,4 +30,4 @@ description: 'A content type that can be used for writing a new page to the guid help: '' new_revision: true preview_mode: 1 -display_submitted: false \ No newline at end of file +display_submitted: false diff --git a/drupal/modules/avoindata-theme/avoindata.theme b/drupal/modules/avoindata-theme/avoindata.theme index 7153fece07..eb91a2c58d 100644 --- a/drupal/modules/avoindata-theme/avoindata.theme +++ b/drupal/modules/avoindata-theme/avoindata.theme @@ -80,10 +80,20 @@ function avoindata_preprocess_block(&$variables) { 'class' => '', 'menucounter' => true, ], + 'faqmenuen' => [ + 'href' => '/en/faq', + 'class' => '', + 'menucounter' => false, + ], 'faqmenufi' => [ 'href' => '/fi/ukk', 'class' => '', 'menucounter' => false, + ], + 'faqmenusv' => [ + 'href' => '/sv/vanliga-fragor', + 'class' => '', + 'menucounter' => false, ] ]; diff --git a/drupal/modules/avoindata-theme/config/install/block.block.faqmenuen.yml b/drupal/modules/avoindata-theme/config/install/block.block.faqmenuen.yml new file mode 100644 index 0000000000..73f2283def --- /dev/null +++ b/drupal/modules/avoindata-theme/config/install/block.block.faqmenuen.yml @@ -0,0 +1,44 @@ +langcode: en +status: true +dependencies: + config: + - system.menu.faq-menu-en + module: + - language + - node + - system + theme: + - avoindata +id: faqmenuen +theme: avoindata +region: guide_menu +weight: 0 +provider: null +plugin: 'system_menu_block:faq-menu-en' +settings: + id: 'system_menu_block:faq-menu-en' + label: Frequently Asked Questions + label_display: visible + provider: system + level: 1 + depth: 0 + expand_all_items: false +visibility: + 'entity_bundle:node': + id: 'entity_bundle:node' + negate: false + context_mapping: + node: '@node.node_route_context:node' + bundles: + avoindata_guide_page: avoindata_guide_page + language: + id: language + negate: false + context_mapping: + language: '@language.current_language_context:language_interface' + langcodes: + en: en + request_path: + id: request_path + negate: false + pages: "/faq\r\n/faq/*" diff --git a/drupal/modules/avoindata-theme/config/install/block.block.faqmenusv.yml b/drupal/modules/avoindata-theme/config/install/block.block.faqmenusv.yml new file mode 100644 index 0000000000..019e367e15 --- /dev/null +++ b/drupal/modules/avoindata-theme/config/install/block.block.faqmenusv.yml @@ -0,0 +1,44 @@ +langcode: sv +status: true +dependencies: + config: + - system.menu.faq-menu-sv + module: + - language + - node + - system + theme: + - avoindata +id: faqmenusv +theme: avoindata +region: guide_menu +weight: 0 +provider: null +plugin: 'system_menu_block:faq-menu-sv' +settings: + id: 'system_menu_block:faq-menu-sv' + label: Vanliga frågor + label_display: visible + provider: system + level: 1 + depth: 0 + expand_all_items: false +visibility: + 'entity_bundle:node': + id: 'entity_bundle:node' + negate: false + context_mapping: + node: '@node.node_route_context:node' + bundles: + avoindata_guide_page: avoindata_guide_page + language: + id: language + negate: false + context_mapping: + language: '@language.current_language_context:language_interface' + langcodes: + sv: sv + request_path: + id: request_path + negate: false + pages: "/vanliga-fragor\r\n/vanliga-fragor/*" diff --git a/drupal/modules/avoindata-theme/config/install/system.menu.faq-menu-en.yml b/drupal/modules/avoindata-theme/config/install/system.menu.faq-menu-en.yml new file mode 100644 index 0000000000..81c504b204 --- /dev/null +++ b/drupal/modules/avoindata-theme/config/install/system.menu.faq-menu-en.yml @@ -0,0 +1,7 @@ +langcode: en +status: true +dependencies: { } +id: faq-menu-en +label: 'Faq menu (en)' +description: 'Menu for faq page (en)' +locked: false diff --git a/drupal/modules/avoindata-theme/config/install/system.menu.faq-menu-sv.yml b/drupal/modules/avoindata-theme/config/install/system.menu.faq-menu-sv.yml new file mode 100644 index 0000000000..0ccf960054 --- /dev/null +++ b/drupal/modules/avoindata-theme/config/install/system.menu.faq-menu-sv.yml @@ -0,0 +1,7 @@ +langcode: sv +status: true +dependencies: { } +id: faq-menu-sv +label: 'Faq menu (sv)' +description: 'Menu for faq page (sv)' +locked: false diff --git a/drupal/modules/avoindata-theme/js/cycle_guide_menu_items.js b/drupal/modules/avoindata-theme/js/cycle_guide_menu_items.js index 36a14eb592..cddf7035c5 100644 --- a/drupal/modules/avoindata-theme/js/cycle_guide_menu_items.js +++ b/drupal/modules/avoindata-theme/js/cycle_guide_menu_items.js @@ -28,7 +28,9 @@ class MenuUtils { 'block-operatingmodelmenuen-menu', 'block-operatingmodelmenufi-menu', 'block-operatingmodelmenusv-menu', - 'block-faqmenufi-menu' + 'block-faqmenuen-menu', + 'block-faqmenufi-menu', + 'block-faqmenusv-menu' ] this.menuLinkSelectors = [ @@ -44,7 +46,9 @@ class MenuUtils { 'block-operatingmodelmenuen', 'block-operatingmodelmenufi', 'block-operatingmodelmenusv', - 'block-faqmenufi' + 'block-faqmenuen', + 'block-faqmenufi', + 'block-faqmenusv' ] this.menu = this.getMenu(); diff --git a/drupal/modules/avoindata-theme/templates/block/block--faqmenuen.html.twig b/drupal/modules/avoindata-theme/templates/block/block--faqmenuen.html.twig new file mode 100644 index 0000000000..e902510719 --- /dev/null +++ b/drupal/modules/avoindata-theme/templates/block/block--faqmenuen.html.twig @@ -0,0 +1 @@ +{% include "guide-menu-template.html.twig" %} diff --git a/drupal/modules/avoindata-theme/templates/block/block--faqmenusv.html.twig b/drupal/modules/avoindata-theme/templates/block/block--faqmenusv.html.twig new file mode 100644 index 0000000000..e902510719 --- /dev/null +++ b/drupal/modules/avoindata-theme/templates/block/block--faqmenusv.html.twig @@ -0,0 +1 @@ +{% include "guide-menu-template.html.twig" %}