Skip to content

Commit

Permalink
Merge branch 'feature/SRL-616-global-language-button' into deployment…
Browse files Browse the repository at this point in the history
…/20220629
  • Loading branch information
melwong-jcc committed Jun 29, 2022
2 parents c1b957d + c68e2ba commit 60921be
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ packages:
harvesthq/chosen: 1.8.7
html2text/html2text: 4.0.1
joachim-n/composer-manifest: 1.0.4
judicialcouncil/courtyard-artifact: 0.1.333
judicialcouncil/courtyard-artifact: 0.1.335
kub-at/php-simple-html-dom-parser: 1.9.1
laminas/laminas-diactoros: 1.8.7p2
laminas/laminas-escaper: 2.6.1
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions config/config-default/system.menu.global-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
uuid: 4b0d0c16-51a9-49fc-8439-8796d46e6a56
langcode: en
status: true
dependencies: { }
id: global-translations
label: 'Global translations'
description: ''
locked: false
21 changes: 21 additions & 0 deletions web/themes/custom/atrium/includes/page.inc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function atrium_preprocess_page(&$variables) {
$variables['menu_hat'] = _atrium_get_menutree('hat');
$variables['menu_footer'] = _atrium_get_menutree('footer');
$variables['translation_links'] = _atrium_translation_menu();
$variables['global_links'] = _atrium_global_translation_menu();

// Social links for footer.
$social = [];
Expand Down Expand Up @@ -209,3 +210,23 @@ function _atrium_translation_menu() {
}
return $links;
}

/**
* Format Global language links for drobputton component.
*
* @return array
* Array of global link items for dropbutton component.
*/
function _atrium_global_translation_menu() {
$host = \Drupal::request()->getSchemeAndHttpHost();

$tree = \Drupal::menuTree()->load('global-translations', new \Drupal\Core\Menu\MenuTreeParameters());
$global_links = [];
$links_index = 0;
foreach ($tree as $item) {
$global_links[$links_index]['title'] = $item->link->getTitle();
$global_links[$links_index]['href'] = $host . $item->link->getUrlObject()->toString();
$links_index ++;
}
return $global_links;
}
4 changes: 3 additions & 1 deletion web/themes/custom/atrium/templates/page/page-header.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
accordion_button: {
id: 'extended-nav-section-two',
label: 'Translate',
links: translation_links
links: translation_links,
global_links: global_links,
global_links_label: "More languages resources"
}
}
}
Expand Down

0 comments on commit 60921be

Please sign in to comment.