2015-11-16 16:05:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A formatter for the notification flyout popup. Just the bare data needed to
|
|
|
|
* render everything client-side.
|
|
|
|
*/
|
2016-01-12 22:30:51 +00:00
|
|
|
class EchoModelFormatter extends EchoEventFormatter {
|
2015-11-16 16:05:07 +00:00
|
|
|
/**
|
|
|
|
* @param EchoEventPresentationModel $model
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function formatModel( EchoEventPresentationModel $model ) {
|
|
|
|
$data = $model->jsonSerialize();
|
|
|
|
$data['iconUrl'] = EchoNotificationFormatter::getIconUrl( $model->getIconType(), $this->language->getDir() );
|
2016-02-23 17:46:36 +00:00
|
|
|
|
|
|
|
if ( isset( $data['links']['primary']['url'] ) ) {
|
|
|
|
$data['links']['primary']['url'] = wfExpandUrl( $data['links']['primary']['url'] );
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ( $data['links']['secondary'] as &$link ) {
|
|
|
|
$link['url'] = wfExpandUrl( $link['url'] );
|
|
|
|
}
|
|
|
|
|
2015-11-16 16:05:07 +00:00
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|