public static function format($hook, $type, $notification, $params) {

		$event = elgg_extract('event', $params);
		$comment = $event->getObject();
		$recipient = elgg_extract('recipient', $params);
		$language = elgg_extract('language', $params);

		if (!$comment instanceof Comment) {
			return;
		}

		$entity = $comment->getContainerEntity();
		if (!$entity) {
			return;
		}

		$messages = (new NotificationFormatter($comment, $recipient, $language))->prepare();

		$notification->summary = $messages->summary;
		$notification->subject = $messages->subject;
		$notification->body = $messages->body;

		return $notification;
	}
public static function format($hook, $type, $notification, $params) {

		$event = elgg_extract('event', $params);
		$comment = $event->getObject();
		$recipient = elgg_extract('recipient', $params);
		$language = elgg_extract('language', $params);

		if (!$comment instanceof Comment) {
			return;
		}

		$entity = $comment->getContainerEntity();
		if (!$entity) {
			return;
		}

		$messages = (new NotificationFormatter($comment, $recipient, $language))->prepare();

		$notification->summary = $messages->summary;
		$notification->subject = $messages->subject;
		$notification->body = $messages->body;

		return $notification;
	}
public static function format ( $ hook , $ type , $ notification , $ params ) { $ event = elgg_extract ( 'event' , $ params ) ; $ comment = $ event -> getObject ( ) ; $ recipient = elgg_extract ( 'recipient' , $ params ) ; $ language = elgg_extract ( 'language' , $ params ) ; if ( ! $ comment instanceof Comment ) { return ; } $ entity = $ comment -> getContainerEntity ( ) ; if ( ! $ entity ) { return ; } $ messages = ( new NotificationFormatter ( $ comment , $ recipient , $ language ) ) -> prepare ( ) ; $ notification -> summary = $ messages -> summary ; $ notification -> subject = $ messages -> subject ; $ notification -> body = $ messages -> body ; return $ notification ; }
Prepare a notification for when comment is created

@param string       $hook         Equals 'prepare'
@param string       $type         Equals ''notification:create:object:comment'
@param Notification $notification Notification object
@param array        $params       Additional params

@return Notification
Prepare a notification for when comment is created