Merge pull request #178 from tractorcow/pulls/2.0/comment-notification-extensions

API Comment notification extensions
This commit is contained in:
Christopher Pitt 2015-04-09 16:13:01 +12:00
commit db8ff0855c
2 changed files with 39 additions and 0 deletions

View File

@ -6,3 +6,12 @@ Only:
Comment: Comment:
extensions: extensions:
- BlogCommentExtension - BlogCommentExtension
---
Name: blogcommentnotifications
Only:
moduleexists: 'comment-notifications'
---
BlogPost:
extensions:
- BlogPostNotifications

View File

@ -0,0 +1,30 @@
<?php
/**
* Customise blog post to support comment notifications
* Extends {@see BlogPost} with extensions to {@see CommentNotifiable}
*/
class BlogPostNotifications extends DataExtension {
/**
* Notify all authors of notifications
*
* @param type $list
* @param type $comment
*/
public function updateNotificationRecipients(&$list, &$comment) {
// Notify all authors
$list = $this->owner->Authors();
}
/**
* Update comment to include the page title
*
* @param string $subject
* @param Comment $comment
* @param Member|string $recipient
*/
public function updateNotificationSubject(&$subject, &$comment, &$recipient) {
$subject = "A new comment has been posted on " . $this->owner->Title;
}
}