MediaWiki master
MediaWiki\CommentFormatter\RevisionCommentBatch Class Reference

Fluent interface for revision comment batch inputs. More...

Public Member Functions

 __construct (CommentFormatter $formatter)
 
 authority (Authority $authority)
 Set the authority to use for permission checks.
 
 execute ()
 Format the comments.
 
 hideIfDeleted ( $isPublic=true)
 If this is true, show the comment only if all users can see it.
 
 indexById ( $indexById=true)
 If this is true, the array keys in the return value will be the revision IDs instead of the keys from the input array.
 
 revisions ( $revisions)
 Set the revisions to extract comments from.
 
 samePage ( $samePage=true)
 Set the same-page option.
 
 useParentheses ( $useParentheses=true)
 Wrap the comment with parentheses.
 

Detailed Description

Fluent interface for revision comment batch inputs.

Since
1.38

Definition at line 13 of file RevisionCommentBatch.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\CommentFormatter\RevisionCommentBatch::__construct ( CommentFormatter $formatter)
Parameters
CommentFormatter$formatter

Definition at line 32 of file RevisionCommentBatch.php.

Member Function Documentation

◆ authority()

MediaWiki\CommentFormatter\RevisionCommentBatch::authority ( Authority $authority)

Set the authority to use for permission checks.

This must be called prior to execute().

Parameters
Authority$authority
Returns
$this

Definition at line 43 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\authority().

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\authority(), and MediaWiki\CommentFormatter\RevisionCommentBatch\execute().

◆ execute()

MediaWiki\CommentFormatter\RevisionCommentBatch::execute ( )

Format the comments.

Returns
string[] Formatted comments. The array key is either the field value specified by indexField(), or if that was not called, it is the key from the array passed to revisions().

Definition at line 123 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\authority(), MediaWiki\CommentFormatter\RevisionCommentBatch\indexById(), MediaWiki\CommentFormatter\RevisionCommentBatch\revisions(), MediaWiki\CommentFormatter\RevisionCommentBatch\samePage(), and MediaWiki\CommentFormatter\RevisionCommentBatch\useParentheses().

◆ hideIfDeleted()

MediaWiki\CommentFormatter\RevisionCommentBatch::hideIfDeleted ( $isPublic = true)

If this is true, show the comment only if all users can see it.

We'll call it hideIfDeleted() since public is a keyword and isPublic() has an inappropriate verb.

Parameters
bool$isPublic
Returns
$this

Definition at line 99 of file RevisionCommentBatch.php.

◆ indexById()

MediaWiki\CommentFormatter\RevisionCommentBatch::indexById ( $indexById = true)

If this is true, the array keys in the return value will be the revision IDs instead of the keys from the input array.

Parameters
bool$indexById
Returns
$this

Definition at line 111 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\indexById().

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\execute(), and MediaWiki\CommentFormatter\RevisionCommentBatch\indexById().

◆ revisions()

MediaWiki\CommentFormatter\RevisionCommentBatch::revisions ( $revisions)

Set the revisions to extract comments from.

Parameters
iterable<RevisionRecord>$revisions
Returns
$this

Definition at line 54 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\revisions().

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\execute(), and MediaWiki\CommentFormatter\RevisionCommentBatch\revisions().

◆ samePage()

MediaWiki\CommentFormatter\RevisionCommentBatch::samePage ( $samePage = true)

Set the same-page option.

If this is true, section links and fragment- only wikilinks are rendered with an href that is a fragment-only URL. If it is false (the default), such links go to the self link title.

This is equivalent to $local in the old Linker methods.

Parameters
bool$samePage
Returns
$this

Definition at line 69 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\samePage().

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\execute(), and MediaWiki\CommentFormatter\RevisionCommentBatch\samePage().

◆ useParentheses()

MediaWiki\CommentFormatter\RevisionCommentBatch::useParentheses ( $useParentheses = true)

Wrap the comment with parentheses.

This has no effect if the useBlock option is not enabled.

Unlike the legacy Linker::commentBlock(), this option defaults to false if this method is not called, since that better preserves the fluent style.

Parameters
bool$useParentheses
Returns
$this

Definition at line 85 of file RevisionCommentBatch.php.

References MediaWiki\CommentFormatter\RevisionCommentBatch\useParentheses().

Referenced by MediaWiki\CommentFormatter\RevisionCommentBatch\execute(), and MediaWiki\CommentFormatter\RevisionCommentBatch\useParentheses().


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