Hello,
today I have a Sunday support question to the linker and hooks experts.
I know Hook:LinkEnd and use this almost successfully in an extension to
"tag" User and User_talk page with an additional attribute.
$wgHooks['LinkEnd'][] = 'wfWikiArticleFeedsAddSignatureMarker';
...
#
https://www.mediawiki.org/wiki/Manual:Hooks/LinkEnd
function wfWikiArticleFeedsAddSignatureMarker( $skin, $title, $options,
$text, &$attribs, $ret ) {
if ( $title->getNamespace() == NS_USER) {
$attribs['userpage-link'] = 'true';
} elseif ( $title->getNamespace() == NS_USER_TALK ) {
$attribs['usertalkpage-link'] = 'true';
}
return true;
}
This works perfectly as long as the page exists, but fail to add the
attribute, if a "redlink" is created because the page does not exist.
I suppose that the getNamespace fails in this case,
Perhaps a patch in Linker.php is required to set Namespace already if
the page is non-existent.
Question:
=======
How can I add my attribute as shown also for such links which point to a
non-existing User or Usertalk page ?