MediaWiki  master
MediaWiki\CommentFormatter\RowCommentFormatter Class Reference

This is basically a CommentFormatter with a CommentStore dependency, allowing it to retrieve comment texts directly from database result wrappers. More...

Inheritance diagram for MediaWiki\CommentFormatter\RowCommentFormatter:
Collaboration diagram for MediaWiki\CommentFormatter\RowCommentFormatter:

Public Member Functions

 __construct (CommentParserFactory $commentParserFactory, CommentStore $commentStore)
 
 formatRows ( $rows, $commentKey, $namespaceField=null, $titleField=null, $indexField=null, $useBlock=false, $useParentheses=true)
 Format DB rows using a parametric interface. More...
 
 rows ( $rows)
 Format DB rows using a fluent interface. More...
 
- Public Member Functions inherited from MediaWiki\CommentFormatter\CommentFormatter
 __construct (CommentParserFactory $parserFactory)
 
 createBatch ()
 Format comments using a fluent interface. More...
 
 createRevisionBatch ()
 Format a batch of revision comments using a fluent interface. More...
 
 format (string $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false)
 Format a single comment. More...
 
 formatBlock (string $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false, $useParentheses=true)
 Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return an empty string. More...
 
 formatItems ( $items)
 Format an iterator over CommentItem objects. More...
 
 formatItemsInternal ( $items, $selfLinkTarget=null, $samePage=null, $wikiId=null, $enableSectionLinks=null, $useBlock=null, $useParentheses=null)
 
 formatLinks (string $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false)
 Format links in a comment, ignoring section links in C-style comments. More...
 
 formatLinksUnsafe (string $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false)
 Format a comment, passing through HTML in the input to the output. More...
 
 formatRevision (RevisionRecord $revision, Authority $authority, $samePage=false, $isPublic=false, $useParentheses=true)
 Wrap and format the given revision's comment block, if the specified user is allowed to view it. More...
 
 formatRevisions ( $revisions, Authority $authority, $samePage=false, $isPublic=false, $useParentheses=true, $indexById=false)
 Format multiple revision comments. More...
 
 formatStrings ( $strings, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false)
 Format comments which are provided as strings and all have the same self-link target and other options. More...
 
 formatStringsAsBlock ( $strings, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false, $useParentheses=true)
 Given an array of comments as strings which all have the same self link target, format the comments and wrap them in standard punctuation and formatting. More...
 

Private Attributes

CommentStore $commentStore
 

Additional Inherited Members

- Protected Member Functions inherited from MediaWiki\CommentFormatter\CommentFormatter
 wrapCommentWithBlock ( $formatted, $useParentheses)
 Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty string. More...
 
- Protected Attributes inherited from MediaWiki\CommentFormatter\CommentFormatter
CommentParserFactory $parserFactory
 

Detailed Description

This is basically a CommentFormatter with a CommentStore dependency, allowing it to retrieve comment texts directly from database result wrappers.

Since
1.38

Definition at line 15 of file RowCommentFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\CommentFormatter\RowCommentFormatter::__construct ( CommentParserFactory  $commentParserFactory,
CommentStore  $commentStore 
)
Access: internal
Use MediaWikiServices::getRowCommentFormatter()
Parameters
CommentParserFactory$commentParserFactory
CommentStore$commentStore

Definition at line 25 of file RowCommentFormatter.php.

References MediaWiki\CommentFormatter\RowCommentFormatter\$commentStore.

Member Function Documentation

◆ formatRows()

MediaWiki\CommentFormatter\RowCommentFormatter::formatRows (   $rows,
  $commentKey,
  $namespaceField = null,
  $titleField = null,
  $indexField = null,
  $useBlock = false,
  $useParentheses = true 
)

Format DB rows using a parametric interface.

Parameters
iterable<

Definition at line 73 of file RowCommentFormatter.php.

References MediaWiki\CommentFormatter\CommentFormatter\createBatch(), and MediaWiki\CommentFormatter\RowCommentFormatter\rows().

◆ rows()

MediaWiki\CommentFormatter\RowCommentFormatter::rows (   $rows)

Format DB rows using a fluent interface.

Pass the return value of this function to CommentBatch::comments().

Example: $comments = $rowCommentFormatter->createBatch() ->comments( $rowCommentFormatter->rows( $rows ) ->commentField( 'img_comment' ) ) ->useBlock( true ) ->execute();

Parameters
Traversable | array$rows
Returns
RowCommentIterator

Definition at line 49 of file RowCommentFormatter.php.

Referenced by MediaWiki\CommentFormatter\RowCommentFormatter\formatRows().

Member Data Documentation

◆ $commentStore

CommentStore MediaWiki\CommentFormatter\RowCommentFormatter::$commentStore
private

The documentation for this class was generated from the following file: