+
+ /**
+ * Generates a custom OOUI icon element with a favicon as the image.
+ * The favicon image URL is generated by parsing the interwiki URL
+ * and returning the default location of the favicon for that domain,
+ * which is assumed to be '/favicon.ico'.
+ *
+ * @param string $iwPrefix Interwiki prefix
+ * @return OOUI\IconWidget
+ **/
+ protected function iwIcon( $iwPrefix ) {
+
+ $interwiki = $this->iwLookup->fetch( $iwPrefix );
+ $parsed = wfParseUrl( wfExpandUrl( $interwiki ? $interwiki->getURL() : '/' ) );
+
+ $iwIconUrl = $parsed['scheme'] .
+ $parsed['delimiter'] .
+ $parsed['host'] .
+ ( $parsed['port'] ? ':' . $parsed['port'] : '' ) .
+ '/favicon.ico';
+
+ $iwIcon = new OOUI\IconWidget( [
+ 'icon' => 'favicon'
+ ] );
+
+ $iwIcon->setAttributes( [ 'style' => "background-image:url($iwIconUrl);" ] );
+
+ return $iwIcon;
+ }