Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
EchoNewsletterPresentationModel | |
0.00% |
0 / 17 |
|
0.00% |
0 / 6 |
56 | |
0.00% |
0 / 1 |
getIconType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
canRender | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
getPrimaryLink | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
getSecondaryLinks | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
getHeaderMessage | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getBodyMessage | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\Newsletter\Notifications; |
4 | |
5 | /** |
6 | * Class that returns structured data for the newsletter echo events. |
7 | * @see https://www.mediawiki.org/wiki/Echo_%28Notifications%29/New_formatter_system |
8 | */ |
9 | class EchoNewsletterPresentationModel extends BaseNewsletterPresentationModel { |
10 | |
11 | public function getIconType() { |
12 | return 'site'; |
13 | } |
14 | |
15 | public function canRender() { |
16 | return (bool)$this->event->getTitle() && parent::canRender(); |
17 | } |
18 | |
19 | public function getPrimaryLink() { |
20 | return [ |
21 | 'url' => $this->event->getTitle()->getFullURL(), |
22 | 'label' => $this->msg( 'newsletter-notification-link-text-new-issue' ) |
23 | ]; |
24 | } |
25 | |
26 | public function getSecondaryLinks() { |
27 | return [ |
28 | [ |
29 | 'url' => $this->getNewsletterUrl(), |
30 | 'label' => $this->msg( 'newsletter-notification-link-text-view-newsletter' ), |
31 | 'prioritized' => true, |
32 | ], |
33 | ]; |
34 | } |
35 | |
36 | public function getHeaderMessage() { |
37 | $msg = parent::getHeaderMessage(); |
38 | |
39 | // Add the newsletter name |
40 | return $msg->params( $this->getNewsletterName() ); |
41 | } |
42 | |
43 | public function getBodyMessage() { |
44 | return $this->msg( 'notification-body-newsletter-announce' ) |
45 | ->params( $this->event->getExtraParam( 'section-text' ) ); |
46 | } |
47 | |
48 | } |