Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
8.5.11
Browse files Browse the repository at this point in the history
- removed plus-sign from toggleText (#247)
- D8CORE-2489 - add `aria-current` (#246)
  • Loading branch information
pookmish authored Oct 8, 2021
2 parents ab964e1 + 665134c commit 9cb694d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Stanford Basic Theme


8.x-5.11
--------------------------------------------------------------------------------
_Release Date: 2021-10-08_

- removed plus-sign from toggleText (#247)
- D8CORE-2489 - add `aria-current` (#246)


8.x-5.10
--------------------------------------------------------------------------------
_Release Date: 2021-09-09_
Expand Down
2 changes: 1 addition & 1 deletion dist/js/base.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class SecondaryNavButtons extends SecondaryNavAbstract {
itemExpandedClass: 'su-secondary-nav__item--expanded',
toggleClass: 'su-nav-toggle',
toggleLabel: 'expand menu',
subNavToggleText: '+'
subNavToggleText: ''
}, options);

// Call the super.
Expand Down
2 changes: 1 addition & 1 deletion stanford_basic.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Stanford Basic'
type: theme
description: 'Stanford Basic Branding Theme.'
package: Stanford
version: 8.x-5.10
version: 8.x-5.11
core_version_requirement: ^9
'base theme': stable9
regions:
Expand Down
16 changes: 15 additions & 1 deletion stanford_basic.theme
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,26 @@ function stanford_basic_preprocess_block__system_branding_block(&$vars) {
* Implements hook_preprocess_menu().
*/
function stanford_basic_preprocess_menu(&$variables, $hook) {

// This should run for every menu.
$current_path = \Drupal::request()->getRequestUri();
$items = $variables['items'];
foreach ($items as $key => $item) {
// If path is current_path, add aria-current to the link.
if (parse_url($item['url']->toString(), PHP_URL_PATH) == $current_path) {
$link_options = $variables['items'][$key]['url']->getOptions();
$link_options['attributes']= [
'aria-current' => 'true',
];
$variables['items'][$key]['url']->setOptions($link_options);
$variables['items'][$key]['attributes']['aria-current'] = 'true';
}
}

// The following code should only run for the main menu.
if ($variables['menu_name'] !== "main") {
return;
}

foreach ($variables['items'] as &$item) {
$menu_item = [$item];
_stanford_basic_menu_process_submenu($menu_item, $current_path);
Expand Down

0 comments on commit 9cb694d

Please sign in to comment.