ProfessionalWiki / chameleon

Provides a highly flexible and customizable skin using Bootstrap 4
https://www.mediawiki.org/wiki/Skin:Chameleon
Other
114 stars 62 forks source link

Add a hook for customizing the PersonalTools toggle <a> inner html #355

Closed mdoggydog closed 1 year ago

mdoggydog commented 1 year ago

This commit adds a ChameleonNavbarHorizontalPersonalToolsLinkInnerHtml hook which can be used to completely customize the inner html of the dropdown toggle link of PersonalTools.

This hook will be passed three parameters:

The first two parameters are strings bearing the values computed by the PersonalTools component (according to its configuration, etc), which the hook function may modify (or leave alone).

After the hook function is complete, the values of $newtalkNotifierHtml and $userNameHtml will be concatenated (in that order) to yield the raw html content of the dropdown toggle's <a> element.

mdoggydog commented 1 year ago

(We're using this hook to inject an avatar into the PersonalTools toggle if a logged-in user has one.

In retrospect, #347 is not strictly necessary if this hook is available, but I suppose it is better to do as little code/style replication in the hook function as possible.

Anyhow, none of the hooks are documented anywhere... so no one is going to know that this is even available anyway. ;^) )