mediawiki-extensions-Thanks/FlowThanksPresentationModel.php
Matthew Flaschen 5a399e8fbf Use plaintextParams for topic title escaping
Merge at the same time as If829deba8577cbe37178d630fb932a299a163193
(in Flow).

Bug: T120291
Change-Id: Ifc6f0c25ecd6a0a6d84481e18b512cf0af09d22f
2016-02-12 20:03:05 -05:00

52 lines
1.3 KiB
PHP

<?php
class EchoFlowThanksPresentationModel extends Flow\FlowPresentationModel {
public function canRender() {
return (bool)$this->event->getTitle();
}
public function getIconType() {
return 'thanks';
}
public function getHeaderMessage() {
$msg = parent::getHeaderMessage();
$truncatedTopicTitle = $this->getTopicTitle();
$msg->plaintextParams( $truncatedTopicTitle );
$msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) );
$msg->params( $this->getViewingUserForGender() );
return $msg;
}
public function getPrimaryLink() {
$title = $this->event->getTitle();
// Make a link to #flow-post-{postid}
$title = Title::makeTitle(
$title->getNamespace(),
$title->getDBKey(),
'flow-post-' . $this->event->getExtraParam( 'post-id' )
);
return array(
'url' => $title->getFullURL( array(
'workflow' => $this->event->getExtraParam( 'workflow' )
) ),
'label' => $this->msg( 'notification-link-text-view-post' )->text(),
);
}
public function getSecondaryLinks() {
$titleLink = array(
'url' => $this->event->getTitle()->getLocalURL(),
'label' => $this->event->getTitle()->getPrefixedText(),
'description' => '',
'icon' => 'speechBubbles',
'prioritized' => true,
);
return array( $this->getAgentLink(), $titleLink );
}
}