Closed mdoggydog closed 1 year ago
FYI, the original motivation behind this PR was that I wanted to add tooltips (title
attributes) to nav-links created by the Menu
component. It looked like it was going to be a pain, to pass another parameter up through a chain of methods in many different places in MenuFromLines.php
, etc....
At some point it occurred to me that NavMenu
already does pretty much everything that Menu
does, and more (e.g., tooltips and access-keys) all in the "standard" MediaWiki way, by sticking everything in MediaWiki:Sidebar
. The only thing missing was the ability to be selective about which chunks of Sidebar
would be rendered in which areas of the UI. (NavMenu
has no mechanism for assigning extra classes to individual items like Menu
does, but with the awesome power of the SCSS customization, this is not really necessary.)
Again, apologies for the lack of unit-tests.
This commit adds new
include
andexclude
attributes to theNavMenu
component. Both are intended to hold semicolon-separated lists of menu section names. If neither is specified, the behavior is unchanged from the current behavior. Ifinclude
is provided, only the specified sections from the sidebar are processed. Ifexclude
is provided, the specified sections are skipped.These options are complementary, and allow one to locate different menu sections in different
NavMenu
instances, e.g., in different locations on the page.