Debian Codegraph @

extensions/Echo/includes/Formatters/EchoManualPresentationModel.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\Notifications\Formatters;
4
5 class EchoManualPresentationModel extends EchoEventPresentationModel {
6
7 /** @inheritDoc */
8 public function getIconType() {
9 return 'robot';
10 }
11
12 /** @inheritDoc */
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 /** @inheritDoc */
19 public function getSubjectMessage() {
20 return $this->getHeaderMessage();
21 }
22
23 /** @inheritDoc */
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 /** @inheritDoc */
35 public function getBodyMessage() {
36 $content = $this->event->getExtraParam( 'content' );
37
38 // Content here passed through plaintextParams for sanitization
39 return $content ? $this->msg( 'notification-body-api-triggered' )->plaintextParams( $content ) : false;
40 }
41
42 /** @inheritDoc */
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 }