| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\Notifications\Formatters; |
| 4 |
|
| 5 |
class EchoManualPresentationModel extends EchoEventPresentationModel { |
| 6 |
|
| 7 |
|
| 8 |
public function getIconType() { |
| 9 |
return 'robot'; |
| 10 |
} |
| 11 |
|
| 12 |
|
| 13 |
public function getHeaderMessage() { |
| 14 |
return $this->msg( 'notification-header-api-triggered' ) |
| 15 |
->plaintextParams( $this->event->getExtraParam( 'header' ), $this->event->getAgent()->getName() ); |
| 16 |
} |
| 17 |
|
| 18 |
|
| 19 |
public function getSubjectMessage() { |
| 20 |
return $this->getHeaderMessage(); |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
public function getPrimaryLink() { |
| 25 |
if ( !$this->event->getTitle() ) { |
| 26 |
return false; |
| 27 |
} |
| 28 |
return [ |
| 29 |
'url' => $this->event->getTitle()->getLocalURL(), |
| 30 |
'label' => $this->msg( 'notification-link-api-triggered' )->text(), |
| 31 |
]; |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
public function getBodyMessage() { |
| 36 |
$content = $this->event->getExtraParam( 'content' ); |
| 37 |
|
| 38 |
|
| 39 |
return $content ? $this->msg( 'notification-body-api-triggered' )->plaintextParams( $content ) : false; |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
public function getSecondaryLinks() { |
| 44 |
$agentLink = $this->getAgentLink(); |
| 45 |
$agentLink['tooltip'] = $this->msg( 'notification-tooltip-api-triggered', |
| 46 |
$this->event->getAgent()->getName() ); |
| 47 |
return [ |
| 48 |
$agentLink |
| 49 |
]; |
| 50 |
} |
| 51 |
} |