Topic on Extension talk:StructuredDiscussions

Accessing talk page from topic in PHP

3
Tinss (talkcontribs)

Hello,

I'm trying to write a hook that redirects topic pages (linked from notifications) to the talk page from which it belongs. I know there is a link to the talk page on the topic page, but it's an extra step I'd like to get rid of. I'm using the ArticleFromTitle hook and after searching for hours, I'm still baffled as to how I'm suppose to get the talk page's Title object from the topic's Title object.

Any help would be much appreciated.

Roan Kattouw (WMF) (talkcontribs)
Tinss (talkcontribs)

Thank you very much! Your example was easily adaptable to my use case. In order to redirect I called $context->getOutput()->redirect($subject->getFullURL($query)); from inside the ArticleFromTitle hook.