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.
|
|
|
|
*/
|
|
|
|
class EchoModelFormatter extends EchoFlyoutFormatter {
|
|
|
|
/**
|
|
|
|
* @param EchoEventPresentationModel $model
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function formatModel( EchoEventPresentationModel $model ) {
|
|
|
|
$data = $model->jsonSerialize();
|
|
|
|
$data['iconUrl'] = EchoNotificationFormatter::getIconUrl( $model->getIconType(), $this->language->getDir() );
|
2015-12-08 00:49:24 +00:00
|
|
|
$data['links']['primary'] = EchoLinkNormalizer::normalizePrimaryLink( $data['links']['primary'] );
|
|
|
|
$data['links']['secondary'] = EchoLinkNormalizer::normalizeSecondaryLinks( $data['links']['secondary'] );
|
2015-11-16 16:05:07 +00:00
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|