Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
CategoryViewerFormatter | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
format | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace Flow\Formatter; |
4 | |
5 | use Flow\RevisionActionPermissions; |
6 | use MediaWiki\MediaWikiServices; |
7 | |
8 | /** |
9 | * Formats single lines for inclusion on the page renders in |
10 | * NS_CATEGORY. Expects that all rows passed in are topic |
11 | * titles. |
12 | */ |
13 | class CategoryViewerFormatter { |
14 | /** |
15 | * @var RevisionActionPermissions |
16 | */ |
17 | protected $permissions; |
18 | |
19 | public function __construct( RevisionActionPermissions $permissions ) { |
20 | $this->permissions = $permissions; |
21 | } |
22 | |
23 | public function format( FormatterRow $row ) { |
24 | if ( !$this->permissions->isAllowed( $row->revision, 'view' ) ) { |
25 | return ''; |
26 | } |
27 | |
28 | $topic = MediaWikiServices::getInstance()->getLinkRenderer()->makeLink( |
29 | $row->workflow->getArticleTitle(), |
30 | $row->revision->getContent( 'topic-title-wikitext' ), |
31 | [ 'class' => 'mw-title' ] |
32 | ); |
33 | |
34 | $board = MediaWikiServices::getInstance()->getLinkRenderer()->makeLink( |
35 | $row->workflow->getOwnerTitle() |
36 | ); |
37 | |
38 | return wfMessage( 'flow-rc-topic-of-board' )->rawParams( $topic, $board )->escaped(); |
39 | } |
40 | } |