Add SkinTemplateGetLanguageLink hook
authorBene <benestar.wikimedia@googlemail.com>
Mon, 3 Feb 2014 20:58:53 +0000 (21:58 +0100)
committerBene <benestar.wikimedia@googlemail.com>
Wed, 5 Feb 2014 19:28:51 +0000 (20:28 +0100)
Added SkinTemplateGetLanguageLink hook to allow changing the html of
language links. This is needed by the Wikibase extension to display badges
of sitelinks.

Bug: 60717
Change-Id: I223bf7a7bb0d13942a81b1766acbee62e080348d

RELEASE-NOTES-1.23
docs/hooks.txt
includes/SkinTemplate.php

index cd602a1..fe0eabf 100644 (file)
@@ -84,6 +84,8 @@ production.
   revision comparison pages using syntax such as [[Special:Diff/12345]],
   [[Special:Diff/12345/prev]] or [[Special:Diff/12345/98765]].
 * New user accounts' personal and talk pages are now watched by them by default.
+* Added SkinTemplateGetLanguageLink hook to allow changing the html of language
+  links.
 
 === Bug fixes in 1.23 ===
 * (bug 41759) The "updated since last visit" markers (on history pages, recent
index a638703..37ac2be 100644 (file)
@@ -2193,6 +2193,13 @@ link" tab.
 $sktemplate: SkinTemplate object
 $nav_urls: array of tabs
 
+'SkinTemplateGetLanguageLink': After building the data for a language link from
+which the actual html is constructed.
+&$languageLink: array containing data about the link. The following keys can be
+  modified: href, text, title, class, lang, hreflang. Each of them is a string.
+$languageLinkTitle: Title object belonging to the external language link
+$title: Title object of the page the link belongs to
+
 To alter the structured navigation links in SkinTemplates, there are three
 hooks called in different spots:
 
index 35183ce..7e229ee 100644 (file)
@@ -175,7 +175,7 @@ class SkinTemplate extends Skin {
                                }
 
                                $ilInterwikiCodeBCP47 = wfBCP47( $ilInterwikiCode );
-                               $languageLinks[] = array(
+                               $languageLink = array(
                                        'href' => $languageLinkTitle->getFullURL(),
                                        'text' => $ilLangName,
                                        'title' => $ilTitle,
@@ -183,6 +183,8 @@ class SkinTemplate extends Skin {
                                        'lang' => $ilInterwikiCodeBCP47,
                                        'hreflang' => $ilInterwikiCodeBCP47,
                                );
+                               wfRunHooks( 'SkinTemplateGetLanguageLink', array( &$languageLink, $languageLinkTitle, $this->getTitle() ) );
+                               $languageLinks[] = $languageLink;
                        }
                }