MediaWiki master
ChangeTagsRevisionItem.php
Go to the documentation of this file.
1<?php
8
14
22
24 public function __construct(
26 $row,
27 private readonly ChangeTagsFormatter $changeTagsFormatter,
28 ) {
29 parent::__construct( $list, $row );
30 }
31
35 public function getTags() {
36 return $this->row->ts_tags;
37 }
38
43 public function getHTML() {
44 $difflink = $this->list->msg( 'parentheses' )
45 ->rawParams( $this->getDiffLink() )->escaped();
46 $revlink = $this->getRevisionLink();
47 $userlink = Linker::revUserLink( $this->getRevisionRecord() );
48 $comment = MediaWikiServices::getInstance()->getCommentFormatter()
49 ->formatRevision( $this->getRevisionRecord(), $this->list->getAuthority() );
50 if ( $this->isDeleted() ) {
51 $class = Linker::getRevisionDeletedClass( $this->getRevisionRecord() );
52 $revlink = "<span class=\"$class\">$revlink</span>";
53 }
54
55 $content = "$difflink $revlink $userlink $comment";
56 $attribs = [];
57 $tags = $this->getTags();
58 if ( $tags ) {
59 [ $tagSummary, $classes ] = $this->changeTagsFormatter->formatTagsAsSummaryList(
60 $tags,
61 $this->list->getContext(),
62 $this->list->getAuthority()
63 );
64 $content .= " $tagSummary";
65 $attribs['class'] = $classes;
66 }
67 return Html::rawElement( 'li', $attribs, $content );
68 }
69}
70
72class_alias( ChangeTagsRevisionItem::class, 'ChangeTagsRevisionItem' );
Formats change tags for display in HTML and use filter dropdown menus.
Item class for a live revision table row with its associated change tags.
__construct(RevisionListBase $list, $row, private readonly ChangeTagsFormatter $changeTagsFormatter,)
This class is a collection of static functions that serve two purposes:
Definition Html.php:44
Some internal bits split of from Skin.php.
Definition Linker.php:48
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
stdClass $row
The database result row.
Item class for a live revision table row.
getDiffLink()
Get the HTML link to the diff.
getRevisionRecord()
Get the RevisionRecord for the item.
getRevisionLink()
Get the HTML link to the revision text.
List for revision table items for a single page.