/** * This overrides the default title link to include highlights for the posts * that have not yet been seen. * * @param array $data * @param FormatterRow $row * @param IContextSource $ctx * @return string */ protected function getTitleLink(array $data, FormatterRow $row, IContextSource $ctx) { if (!$row instanceof RecentChangesRow) { // actually, this should be typehint, but can't because this needs // to match the parent's more generic typehint return parent::getTitleLink($data, $row, $ctx); } if (!isset($data['links']['topic']) || !$data['links']['topic'] instanceof Anchor) { // no valid title anchor (probably header entry) return parent::getTitleLink($data, $row, $ctx); } $watched = $row->recentChange->getAttribute('wl_notificationtimestamp'); if (is_bool($watched)) { // RC & watchlist share most code; the latter is unaware of when // something was watched though, so we'll ignore that here return parent::getTitleLink($data, $row, $ctx); } if ($watched === null) { // there is no data for unread posts - they've all been seen return parent::getTitleLink($data, $row, $ctx); } // get comparison UUID corresponding to this last watched timestamp $uuid = UUID::getComparisonUUID($watched); // add highlight details to anchor /** @var Anchor $anchor */ $anchor = clone $data['links']['topic']; $anchor->query['fromnotif'] = '1'; $anchor->fragment = '#flow-post-' . $uuid->getAlphadecimal(); $data['links']['topic'] = $anchor; // now pass it on to parent with the new, updated, link ;) return parent::getTitleLink($data, $row, $ctx); }