-
-
Save anonymous/d82717f722e8dc0bebc54fb6b4c7104e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @file | |
*/ | |
/** | |
* Display the active parent menu item name above the sidebar subtree menu. | |
*/ | |
(function($) { | |
"use strict"; | |
Drupal.behaviors.ComponentsBlockTitle = { | |
attach: function (context) { | |
// Only run on pages with a sidebar submenu. | |
if ($('.region-sidebar-first #block-nama-d8-main-menu', context).length) { | |
// Get the parent menu item name. | |
var parentMenuItem = $('.region-primary-menu .menu-item--active-trail a', context).text(); | |
// Add it above the sidebar menu. | |
$('<h2>' + parentMenuItem + '</h2>', context).insertBefore('.region-sidebar-first #block-nama-d8-main-menu'); | |
} | |
} | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment