3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
21 use MediaWiki\Html\Html
;
22 use MediaWiki\Linker\Linker
;
23 use MediaWiki\MediaWikiServices
;
24 use MediaWiki\RevisionList\RevisionItem
;
27 * Item class for a live revision table row with its associated change tags.
32 class ChangeTagsRevisionItem
extends RevisionItem
{
34 * @return string Comma-separated list of tags
36 public function getTags() {
37 return $this->row
->ts_tags
;
41 * @return string A HTML <li> element representing this revision, showing
42 * change tags and everything
44 public function getHTML() {
45 $difflink = $this->list->msg( 'parentheses' )
46 ->rawParams( $this->getDiffLink() )->escaped();
47 $revlink = $this->getRevisionLink();
48 $userlink = Linker
::revUserLink( $this->getRevisionRecord() );
49 $comment = MediaWikiServices
::getInstance()->getCommentFormatter()
50 ->formatRevision( $this->getRevisionRecord(), $this->list->getAuthority() );
51 if ( $this->isDeleted() ) {
52 $class = Linker
::getRevisionDeletedClass( $this->getRevisionRecord() );
53 $revlink = "<span class=\"$class\">$revlink</span>";
56 $content = "$difflink $revlink $userlink $comment";
58 $tags = $this->getTags();
60 [ $tagSummary, $classes ] = ChangeTags
::formatSummaryRow(
63 $this->list->getContext()
65 $content .= " $tagSummary";
66 $attribs['class'] = implode( ' ', $classes );
68 return Html
::rawElement( 'li', $attribs, $content );