Following the code through, we are starting with your call to
EchoBasicFormatter::setTitleLink(). The third argument you are asking
about is labeled props, and gets passed on to
EchoBasicFormatter::buildLinkParams(). This is the function that deals
with the contents of that argument. From reading the code the following
are valid keys in the props array: param, fragment, attribs, linkText. All
of these are used as arguments for a call to Linker::link() which is the
canonical anchor(<a>) generator in mediawiki.
Unfortunatly this means the contents of the param array are entirely
arbitrary, they are used as part of the query string in an anchor generated
by calling setTitleLink(). In mediawiki visiting any wikitext page with
the query string 'oldid=XXXXX&diff=prev' will load up the revision
specified by XXXXX and output the diff between it and its prior revision.
I'm not aware of any list anywhere that summarizes the possible query
parameters mediawiki accepts for wikitext pages.
Erik B.
On Wed, Dec 3, 2014 at 7:56 AM, Yury Katkov <katkov.juriy(a)gmail.com> wrote:
Hi everyone!
I'm trying to write my notification for Echo and I'm a bit stuck coding the
formatter. The standard way to write a formatter seems to override the
processParam function (like in Thanks extension). There is a lot of magic
in the code below, I can't figure out how the processParam function must be
handled. My questions are in the comments and if someone can explain a
little bit of what's possible to do inside processParam, I'd be very
grateful.
class EchoThanksFormatter extends EchoBasicFormatter {
protected function processParam( $event, $param, $message, $user ) {
if ( $param === 'difflink' ) {
$eventData = $event->getExtra();
if ( !isset( $eventData['revid'] ) ) {
$message->params( '' );
return;
}
$this->setTitleLink(
$event,
$message,
array(
'class' => 'mw-echo-diff',
'linkText' => wfMessage(
'notification-thanks-diff-link' )->text(),
'param' => array( // what is the possible structure of
this param array?
'oldid' => $eventData['revid'],
'diff' => 'prev', //what is that? Are diff and
prev
some kind of reserved words? Where can I find the whole list of these
words?
)
)
);
} else {
parent::processParam( $event, $param, $message, $user );
}
}
}
Cheers,
-----
Yury Katkov
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l